Skip to content

Commit 0671dfc

Browse files
authored
Update emsymbolizer and emsize tests (#21305)
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).
1 parent fa57899 commit 0671dfc

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

test/other/test_emsize.out

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
section size addr
2-
TYPE 51 0
3-
IMPORT 31 0
4-
FUNCTION 14 0
5-
GLOBAL 9 0
6-
EXPORT 9 0
7-
ELEM 9 0
8-
CODE 1556 0
9-
DATA 77 0
2+
TYPE 51 10
3+
IMPORT 31 63
4+
FUNCTION 14 96
5+
GLOBAL 9 112
6+
EXPORT 9 123
7+
ELEM 9 134
8+
CODE 1556 146
9+
DATA 77 1704
1010
JS 6756 0
1111
Total 8512

test/test_other.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,6 @@ def test_em_config_missing_arg(self):
823823
out = self.expect_fail([EMCC, '--em-config'])
824824
self.assertContained('error: --em-config must be followed by a filename', out)
825825

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

9704-
@disabled('Updating underlying tool output')
97059703
def test_emsymbolizer(self):
97069704
def check_dwarf_loc_info(address, funcs, locs):
97079705
out = self.run_process(
9708-
[emsymbolizer, '-tcode', '-s', 'dwarf', 'test_dwarf.wasm', address],
9706+
[emsymbolizer, '-s', 'dwarf', 'test_dwarf.wasm', address],
97099707
stdout=PIPE).stdout
97109708
for func in funcs:
97119709
self.assertIn(func, out)
@@ -9714,7 +9712,7 @@ def check_dwarf_loc_info(address, funcs, locs):
97149712

97159713
def check_source_map_loc_info(address, loc):
97169714
out = self.run_process(
9717-
[emsymbolizer, '-tcode', '-s', 'sourcemap', 'test_dwarf.wasm',
9715+
[emsymbolizer, '-s', 'sourcemap', 'test_dwarf.wasm',
97189716
address],
97199717
stdout=PIPE).stdout
97209718
self.assertIn(loc, out)
@@ -9727,7 +9725,7 @@ def check_source_map_loc_info(address, loc):
97279725
# ...
97289726
# 6: 41 00 i32.const 0
97299727
# ...
9730-
# The addresses here are the offsets to start of the code section. Returns
9728+
# The addresses here are the offsets to the start of the file. Returns
97319729
# the address string in hexadecimal.
97329730
def get_addr(text):
97339731
out = self.run_process([common.LLVM_OBJDUMP, '-d', 'test_dwarf.wasm'],

0 commit comments

Comments
 (0)