Skip to content
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