From eebedfd883a9d99fa3e9327a9b87095536f5e1be Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Sun, 5 Mar 2023 12:08:28 -0800 Subject: [PATCH] Remove test dependency on building.llvm_nm_multiple Split out from #18905, which completely removes llvm_nm_multiple. --- test/test_other.py | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/test/test_other.py b/test/test_other.py index 1ff06339467ad..a4294b6fcf3f5 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -28,7 +28,7 @@ raise Exception('do not run this file directly; do something like: test/runner other') from tools.shared import config -from tools.shared import EMCC, EMXX, EMAR, EMRANLIB, FILE_PACKAGER, WINDOWS +from tools.shared import EMCC, EMXX, EMAR, EMRANLIB, FILE_PACKAGER, WINDOWS, LLVM_NM from tools.shared import CLANG_CC, CLANG_CXX, LLVM_AR, LLVM_DWARFDUMP, LLVM_DWP, EMCMAKE, EMCONFIGURE from common import RunnerCore, path_from_root, is_slow_test, ensure_dir, disabled, make_executable from common import env_modify, no_mac, no_windows, requires_native_clang, with_env_modify @@ -149,7 +149,28 @@ def decorated(self, *args, **kwargs): def llvm_nm(file): - return building.llvm_nm_multiple([file])[0] + output = shared.run_process([LLVM_NM, file], stdout=PIPE).stdout + + symbols = { + 'defs': set(), + 'undefs': set(), + 'commons': set(), + } + + for line in output.splitlines(): + # Skip address, which is always fixed-length 8 chars (plus 2 + # leading chars `: ` and one trailing space) + status = line[9] + symbol = line[11:] + + if status == 'U': + symbols['undefs'].add(symbol) + elif status == 'C': + symbols['commons'].add(symbol) + elif status == status.upper(): + symbols['defs'].add(symbol) + + return symbols class other(RunnerCore):