aboutsummaryrefslogtreecommitdiff
path: root/contrib/devtools/test-symbol-check.py
diff options
context:
space:
mode:
authorCarl Dong <contact@carldong.me>2021-01-21 13:52:40 -0500
committerfanquake <fanquake@gmail.com>2021-07-07 19:31:37 +0800
commit9fdc8afe117b7b1ea845f8acae9e831922b8f92b (patch)
treea8add8f24a05ac933e831d16e1b798259eabfd8f /contrib/devtools/test-symbol-check.py
parentbda62eab38c5dd74e222eddedbca19ace9df6daa (diff)
downloadbitcoin-9fdc8afe117b7b1ea845f8acae9e831922b8f92b.tar.xz
devtools: Improve *-check.py tool detection
This is important to make sure that we're not testing tools different from the one we're building with. Introduce determine_wellknown_cmd, which encapsulates how we should handle well-known tools specification (IFS splitting, env override, etc.).
Diffstat (limited to 'contrib/devtools/test-symbol-check.py')
-rwxr-xr-xcontrib/devtools/test-symbol-check.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/contrib/devtools/test-symbol-check.py b/contrib/devtools/test-symbol-check.py
index 6ce2fa3560..56ea02719d 100755
--- a/contrib/devtools/test-symbol-check.py
+++ b/contrib/devtools/test-symbol-check.py
@@ -7,10 +7,13 @@ Test script for symbol-check.py
'''
import os
import subprocess
+from typing import List
import unittest
-def call_symbol_check(cc, source, executable, options):
- subprocess.run([cc,source,'-o',executable] + options, check=True)
+from utils import determine_wellknown_cmd
+
+def call_symbol_check(cc: List[str], source, executable, options):
+ subprocess.run([*cc,source,'-o',executable] + options, check=True)
p = subprocess.run(['./contrib/devtools/symbol-check.py',executable], stdout=subprocess.PIPE, universal_newlines=True)
os.remove(source)
os.remove(executable)
@@ -20,7 +23,7 @@ class TestSymbolChecks(unittest.TestCase):
def test_ELF(self):
source = 'test1.c'
executable = 'test1'
- cc = 'gcc'
+ cc = determine_wellknown_cmd('CC', 'gcc')
# renameat2 was introduced in GLIBC 2.28, so is newer than the upper limit
# of glibc for all platforms
@@ -82,7 +85,7 @@ class TestSymbolChecks(unittest.TestCase):
def test_MACHO(self):
source = 'test1.c'
executable = 'test1'
- cc = 'clang'
+ cc = determine_wellknown_cmd('CC', 'clang')
with open(source, 'w', encoding="utf8") as f:
f.write('''
@@ -132,7 +135,7 @@ class TestSymbolChecks(unittest.TestCase):
def test_PE(self):
source = 'test1.c'
executable = 'test1.exe'
- cc = 'x86_64-w64-mingw32-gcc'
+ cc = determine_wellknown_cmd('CC', 'x86_64-w64-mingw32-gcc')
with open(source, 'w', encoding="utf8") as f:
f.write('''
@@ -182,4 +185,3 @@ class TestSymbolChecks(unittest.TestCase):
if __name__ == '__main__':
unittest.main()
-