diff options
author | Alon Zakai <azakai@google.com> | 2021-05-14 15:21:41 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-14 15:21:41 -0700 |
commit | dc516f10b5fa8fa7bf270eda97950d6e714956d3 (patch) | |
tree | 73602595dacabcc72d2342f7ffd4d0d6cf8f60f3 /test/unit/test_symbolmap.py | |
parent | f59174c1cf526d7e9fe5d4ba74ab0370f40a1856 (diff) | |
download | binaryen-dc516f10b5fa8fa7bf270eda97950d6e714956d3.tar.gz binaryen-dc516f10b5fa8fa7bf270eda97950d6e714956d3.tar.bz2 binaryen-dc516f10b5fa8fa7bf270eda97950d6e714956d3.zip |
Support --symbolmap and --symbolmap=FOO in wasm-opt (#3885)
wasm-as supports --symbolmap=FOO as an argument. We got a request to
support the same in wasm-opt. wasm-opt does have --print-function-map which
does the same, but as a pass. To unify them, use the new pass arg sugar from
#3882 which allows us to add a --symbolmap pass whose argument can be
set as --symbolmap=FOO. That perfectly matches the wasm-as notation.
For now, keep the old --print-function-map notation as well, to not break
emscripten. After we remove it there we can remove it here.
Diffstat (limited to 'test/unit/test_symbolmap.py')
-rw-r--r-- | test/unit/test_symbolmap.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/unit/test_symbolmap.py b/test/unit/test_symbolmap.py new file mode 100644 index 000000000..59ce1847e --- /dev/null +++ b/test/unit/test_symbolmap.py @@ -0,0 +1,20 @@ +from scripts.test import shared +from . import utils + + +class SymbolMapTest(utils.BinaryenTestCase): + def test_symbolmap(self): + input_wasm = self.input_path('hello_world.wat') + # write the symbol map to a file + args = [input_wasm, '--symbolmap=out.symbols'] + shared.run_process(shared.WASM_OPT + args) + with open('out.symbols') as f: + file_output = f.read() + # write the symbol map to stdout + args = [input_wasm, '--symbolmap'] + stdout_output = shared.run_process(shared.WASM_OPT + args, + capture_output=True).stdout + # ignore whitespace in the comparison as on windows stdout gets an \r + self.assertEqual(file_output.strip(), stdout_output.strip()) + # the wat contains a single function "add" + self.assertIn('0:add', file_output) |