diff options
Diffstat (limited to 'scripts/test')
-rwxr-xr-x | scripts/test/lld.py | 55 | ||||
-rwxr-xr-x | scripts/test/s2wasm.py | 1 |
2 files changed, 37 insertions, 19 deletions
diff --git a/scripts/test/lld.py b/scripts/test/lld.py index 793031ca6..85159ba3a 100755 --- a/scripts/test/lld.py +++ b/scripts/test/lld.py @@ -25,36 +25,53 @@ from shared import ( def test_wasm_link_metadata(): print '\n[ checking wasm-link-metadata testcases... ]\n' + extension_arg_map = { + '.json': [], + '.jscall.json': ['--emscripten-reserved-function-pointers=3'], + } + for obj_path in files_with_pattern(options.binaryen_test, 'lld', '*.o'): print '..', obj_path - expected_file = obj_path.replace('.o', '.json') + for ext, ext_args in extension_arg_map.items(): + expected_file = obj_path.replace('.o', ext) + if ext != '.json' and not os.path.exists(expected_file): + continue - cmd = WASM_LINK_METADATA + [obj_path] - actual = run_command(cmd) + cmd = WASM_LINK_METADATA + [obj_path] + ext_args + actual = run_command(cmd) - if not os.path.exists(expected_file): - print actual - fail_with_error('output ' + expected_file + ' does not exist') - expected = open(expected_file, 'rb').read() - if actual != expected: - fail(actual, expected) + if not os.path.exists(expected_file): + print actual + fail_with_error('output ' + expected_file + ' does not exist') + expected = open(expected_file, 'rb').read() + if actual != expected: + fail(actual, expected) def test_wasm_emscripten_finalize(): print '\n[ checking wasm-emscripten-finalize testcases... ]\n' + extension_arg_map = { + '.out': [], + '.jscall.out': ['--emscripten-reserved-function-pointers=3'], + } + for wast_path in files_with_pattern(options.binaryen_test, 'lld', '*.wast'): print '..', wast_path - expected_file = wast_path + '.out' - cmd = WASM_EMSCRIPTEN_FINALIZE + [wast_path, '-S'] - actual = run_command(cmd) - - if not os.path.exists(expected_file): - print actual - fail_with_error('output ' + expected_file + ' does not exist') - expected = open(expected_file, 'rb').read() - if actual != expected: - fail(actual, expected) + for ext, ext_args in extension_arg_map.items(): + expected_file = wast_path + ext + if ext != '.out' and not os.path.exists(expected_file): + continue + + cmd = WASM_EMSCRIPTEN_FINALIZE + [wast_path, '-S'] + ext_args + actual = run_command(cmd) + + if not os.path.exists(expected_file): + print actual + fail_with_error('output ' + expected_file + ' does not exist') + expected = open(expected_file, 'rb').read() + if actual != expected: + fail(actual, expected) if __name__ == '__main__': diff --git a/scripts/test/s2wasm.py b/scripts/test/s2wasm.py index 405ed5fdf..a3345f87b 100755 --- a/scripts/test/s2wasm.py +++ b/scripts/test/s2wasm.py @@ -36,6 +36,7 @@ def test_s2wasm(): '.wast': [], '.clamp.wast': ['--trap-mode=clamp'], '.js.wast': ['--trap-mode=js'], + '.jscall.wast': ['--emscripten-reserved-function-pointers=3'], } for dot_s_dir in ['dot_s', 'llvm_autogenerated']: dot_s_path = os.path.join(options.binaryen_test, dot_s_dir) |