summaryrefslogtreecommitdiff
path: root/test cases/linuxlike
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz93@gmail.com>2024-08-21 02:28:26 -0400
committerEli Schwartz <eschwartz93@gmail.com>2024-09-05 20:42:25 -0400
commit83f8de5357f31d6448ae033e1e8ed2b22c8c306a (patch)
tree90d1523e1de84687977cde0730c286e0176c2753 /test cases/linuxlike
parent6d92547e6c78ac84dda69ac19b5586795317bac9 (diff)
downloadmeson-83f8de5357f31d6448ae033e1e8ed2b22c8c306a.tar.gz
tests: handle uncommon architecture format for nm
The zlib symbols may not be of type 'T' but rather e.g. 'D' -- instead, tell nm to emit the POSIX format and also to only emit defined symbols, not undefined ones. Then we just check if the symbol is listed at all, regardless of type. We already depend on -U elsewhere (e.g symbolextractor). There's no real replacement for it, sadly. It's also buggy in some versions of nm, so we check both its long and short options. Bug: https://bugs.gentoo.org/938259
Diffstat (limited to 'test cases/linuxlike')
-rwxr-xr-xtest cases/linuxlike/14 static dynamic linkage/verify_static.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/test cases/linuxlike/14 static dynamic linkage/verify_static.py b/test cases/linuxlike/14 static dynamic linkage/verify_static.py
index 8d16d48c9..25e97f368 100755
--- a/test cases/linuxlike/14 static dynamic linkage/verify_static.py
+++ b/test cases/linuxlike/14 static dynamic linkage/verify_static.py
@@ -5,8 +5,16 @@ import sys
def handle_common(path):
"""Handle the common case."""
- output = subprocess.check_output(['nm', path]).decode('utf-8')
- if 'T zlibVersion' in output:
+ try:
+ output = subprocess.check_output(['nm', '--defined-only', '-P', '-A', path]).decode('utf-8')
+ except subprocess.CalledProcessError:
+ # some NMs only support -U. Older binutils only supports --defined-only.
+ output = subprocess.check_output(['nm', '-UPA', path]).decode('utf-8')
+ # POSIX format. Prints all *defined* symbols, looks like this:
+ # builddir/main_static: zlibVersion T 1190 39
+ # or
+ # builddir/main_static: zlibVersion D 1fde0 30
+ if ': zlibVersion ' in output:
return 0
return 1