summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@chromium.org>2018-11-14 13:03:30 -0800
committerGitHub <noreply@github.com>2018-11-14 13:03:30 -0800
commit7e9f7f62d230f7ed083c0c2d425ae47dac4f513f (patch)
tree0c9967b8d9708160b5fef2eef6be8ab4046a22dd /scripts
parent37d82ba9574d440a89b1d7f91af89cd30b35b158 (diff)
downloadbinaryen-7e9f7f62d230f7ed083c0c2d425ae47dac4f513f.tar.gz
binaryen-7e9f7f62d230f7ed083c0c2d425ae47dac4f513f.tar.bz2
binaryen-7e9f7f62d230f7ed083c0c2d425ae47dac4f513f.zip
Add wasm-emscripten-finalize flag to separate data segments into a file (#1741)
This writes the data section into a file suitable for use with emscripten's --memory-init-file flag
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/test/lld.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/scripts/test/lld.py b/scripts/test/lld.py
index 4f976ae30..03a0733e6 100755
--- a/scripts/test/lld.py
+++ b/scripts/test/lld.py
@@ -24,13 +24,14 @@ from shared import (
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
+ mem_file = wast_path + '.mem'
+ extension_arg_map = {
+ '.out': [],
+ '.jscall.out': ['--emscripten-reserved-function-pointers=3'],
+ '.mem.out': ['--separate-data-segments', mem_file],
+ }
for ext, ext_args in extension_arg_map.items():
expected_file = wast_path + ext
if ext != '.out' and not os.path.exists(expected_file):
@@ -44,6 +45,11 @@ def test_wasm_emscripten_finalize():
print actual
fail_with_error('output ' + expected_file + ' does not exist')
fail_if_not_identical_to_file(actual, expected_file)
+ if ext == '.mem.out':
+ with open(mem_file) as mf:
+ mem = mf.read()
+ fail_if_not_identical_to_file(mem, wast_path + '.mem.mem')
+ os.remove(mem_file)
if __name__ == '__main__':