diff options
| author | Eli Schwartz <eschwartz93@gmail.com> | 2024-08-21 02:28:26 -0400 |
|---|---|---|
| committer | Eli Schwartz <eschwartz93@gmail.com> | 2024-09-05 20:42:25 -0400 |
| commit | 83f8de5357f31d6448ae033e1e8ed2b22c8c306a (patch) | |
| tree | 90d1523e1de84687977cde0730c286e0176c2753 /test cases/linuxlike | |
| parent | 6d92547e6c78ac84dda69ac19b5586795317bac9 (diff) | |
| download | meson-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-x | test cases/linuxlike/14 static dynamic linkage/verify_static.py | 12 |
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 |
