Skip to content

Remove test dependency on building.llvm_nm_multiple #18908

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down