Skip to content

Commit

Permalink
Update emsymbolizer and emsize tests (emscripten-core#21305)
Browse files Browse the repository at this point in the history
LLVM rev 8b0f47bfa updated section addresses to use binary offsets in linked
wasm files, which is reflected in the llvm-size (and thus emsize) tool. It
also made llvm-objdump display file offsets rather than section offsets when
disassembling binaries. Update the emsize and emsymbolizer tests accordingly
(expect section addresses in emsize, and use file rather than section offsets
in the emsymbolizer test, since the offsets are read from objdump output).
  • Loading branch information
dschuff authored and mrolig5267319 committed Feb 23, 2024
1 parent ea75a9e commit 7ec4c55
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
16 changes: 8 additions & 8 deletions test/other/test_emsize.out
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
section size addr
TYPE 51 0
IMPORT 31 0
FUNCTION 14 0
GLOBAL 9 0
EXPORT 9 0
ELEM 9 0
CODE 1556 0
DATA 77 0
TYPE 51 10
IMPORT 31 63
FUNCTION 14 96
GLOBAL 9 112
EXPORT 9 123
ELEM 9 134
CODE 1556 146
DATA 77 1704
JS 6756 0
Total 8512
8 changes: 3 additions & 5 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,6 @@ def test_em_config_missing_arg(self):
out = self.expect_fail([EMCC, '--em-config'])
self.assertContained('error: --em-config must be followed by a filename', out)

@disabled('Updating underlying tool output')
def test_emsize(self):
# test binaryen generated by running:
# emcc test/hello_world.c -Oz --closure 1 -o test/other/test_emsize.js
Expand Down Expand Up @@ -9701,11 +9700,10 @@ def test(dump_file):
test('foo.wasm.dump')
test('bar.wasm.dump')

@disabled('Updating underlying tool output')
def test_emsymbolizer(self):
def check_dwarf_loc_info(address, funcs, locs):
out = self.run_process(
[emsymbolizer, '-tcode', '-s', 'dwarf', 'test_dwarf.wasm', address],
[emsymbolizer, '-s', 'dwarf', 'test_dwarf.wasm', address],
stdout=PIPE).stdout
for func in funcs:
self.assertIn(func, out)
Expand All @@ -9714,7 +9712,7 @@ def check_dwarf_loc_info(address, funcs, locs):

def check_source_map_loc_info(address, loc):
out = self.run_process(
[emsymbolizer, '-tcode', '-s', 'sourcemap', 'test_dwarf.wasm',
[emsymbolizer, '-s', 'sourcemap', 'test_dwarf.wasm',
address],
stdout=PIPE).stdout
self.assertIn(loc, out)
Expand All @@ -9727,7 +9725,7 @@ def check_source_map_loc_info(address, loc):
# ...
# 6: 41 00 i32.const 0
# ...
# The addresses here are the offsets to start of the code section. Returns
# The addresses here are the offsets to the start of the file. Returns
# the address string in hexadecimal.
def get_addr(text):
out = self.run_process([common.LLVM_OBJDUMP, '-d', 'test_dwarf.wasm'],
Expand Down

0 comments on commit 7ec4c55

Please sign in to comment.