summaryrefslogtreecommitdiff
path: root/scripts/test/lld.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/test/lld.py')
-rwxr-xr-xscripts/test/lld.py55
1 files changed, 36 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__':