Skip to content

Commit eebedfd

Browse files
committed
Remove test dependency on building.llvm_nm_multiple
Split out from #18905, which completely removes llvm_nm_multiple.
1 parent 5441b40 commit eebedfd

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

test/test_other.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
raise Exception('do not run this file directly; do something like: test/runner other')
2929

3030
from tools.shared import config
31-
from tools.shared import EMCC, EMXX, EMAR, EMRANLIB, FILE_PACKAGER, WINDOWS
31+
from tools.shared import EMCC, EMXX, EMAR, EMRANLIB, FILE_PACKAGER, WINDOWS, LLVM_NM
3232
from tools.shared import CLANG_CC, CLANG_CXX, LLVM_AR, LLVM_DWARFDUMP, LLVM_DWP, EMCMAKE, EMCONFIGURE
3333
from common import RunnerCore, path_from_root, is_slow_test, ensure_dir, disabled, make_executable
3434
from common import env_modify, no_mac, no_windows, requires_native_clang, with_env_modify
@@ -149,7 +149,28 @@ def decorated(self, *args, **kwargs):
149149

150150

151151
def llvm_nm(file):
152-
return building.llvm_nm_multiple([file])[0]
152+
output = shared.run_process([LLVM_NM, file], stdout=PIPE).stdout
153+
154+
symbols = {
155+
'defs': set(),
156+
'undefs': set(),
157+
'commons': set(),
158+
}
159+
160+
for line in output.splitlines():
161+
# Skip address, which is always fixed-length 8 chars (plus 2
162+
# leading chars `: ` and one trailing space)
163+
status = line[9]
164+
symbol = line[11:]
165+
166+
if status == 'U':
167+
symbols['undefs'].add(symbol)
168+
elif status == 'C':
169+
symbols['commons'].add(symbol)
170+
elif status == status.upper():
171+
symbols['defs'].add(symbol)
172+
173+
return symbols
153174

154175

155176
class other(RunnerCore):

0 commit comments

Comments
 (0)