summaryrefslogtreecommitdiff
path: root/scripts/test/lld.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/test/lld.py')
-rwxr-xr-xscripts/test/lld.py32
1 files changed, 30 insertions, 2 deletions
diff --git a/scripts/test/lld.py b/scripts/test/lld.py
index 94736f03f..fae551f0d 100755
--- a/scripts/test/lld.py
+++ b/scripts/test/lld.py
@@ -21,6 +21,13 @@ from shared import (
)
+def args_for_finalize(filename):
+ if 'shared' in filename:
+ return ['--side-module']
+ else:
+ return ['--global-base=568', '--initial-stack-pointer=16384']
+
+
def test_wasm_emscripten_finalize():
print '\n[ checking wasm-emscripten-finalize testcases... ]\n'
@@ -36,8 +43,8 @@ def test_wasm_emscripten_finalize():
if ext != '.out' and not os.path.exists(expected_file):
continue
- cmd = (WASM_EMSCRIPTEN_FINALIZE +
- [wast_path, '-S', '--global-base=568', '--initial-stack-pointer=16384'] + ext_args)
+ cmd = WASM_EMSCRIPTEN_FINALIZE + [wast_path, '-S'] + ext_args
+ cmd += args_for_finalize(os.path.basename(wast_path))
actual = run_command(cmd)
if not os.path.exists(expected_file):
@@ -51,5 +58,26 @@ def test_wasm_emscripten_finalize():
os.remove(mem_file)
+def update_lld_tests():
+ print '\n[ updatring wasm-emscripten-finalize testcases... ]\n'
+
+ for wast_path in files_with_pattern(options.binaryen_test, 'lld', '*.wast'):
+ print '..', wast_path
+ mem_file = wast_path + '.mem'
+ extension_arg_map = {
+ '.out': [],
+ '.mem.out': ['--separate-data-segments', mem_file + '.mem'],
+ }
+ for ext, ext_args in extension_arg_map.items():
+ out_path = wast_path + ext
+ if ext != '.out' and not os.path.exists(out_path):
+ continue
+ cmd = WASM_EMSCRIPTEN_FINALIZE + [wast_path, '-S'] + ext_args
+ cmd += args_for_finalize(os.path.basename(wast_path))
+ actual = run_command(cmd)
+ with open(out_path, 'w') as o:
+ o.write(actual)
+
+
if __name__ == '__main__':
test_wasm_emscripten_finalize()