summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/test/wasm_opt.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/scripts/test/wasm_opt.py b/scripts/test/wasm_opt.py
index 986ce2f61..2c7d49eb7 100644
--- a/scripts/test/wasm_opt.py
+++ b/scripts/test/wasm_opt.py
@@ -204,3 +204,29 @@ def update_wasm_opt_tests():
support.run_command(shared.WASM_OPT + ['a.wasm', '--input-source-map=a.map', '-o', 'b.wasm', '--output-source-map=b.map', '-g'])
actual = support.run_command(shared.WASM_DIS + ['b.wasm', '--source-map=b.map'])
open(f, 'w').write(actual)
+
+ print('\n[ checking binary format testcases... ]\n')
+ for wast in shared.get_tests(shared.options.binaryen_test, ['.wast']):
+ for debug_info in [0, 1]:
+ cmd = shared.WASM_AS + [wast, '-o', 'a.wasm', '-all']
+ if debug_info:
+ cmd += ['-g']
+ print(' '.join(cmd))
+ if os.path.exists('a.wasm'):
+ os.unlink('a.wasm')
+ subprocess.check_call(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ assert os.path.exists('a.wasm')
+
+ cmd = shared.WASM_DIS + ['a.wasm', '-o', 'a.wast']
+ print(' '.join(cmd))
+ if os.path.exists('a.wast'):
+ os.unlink('a.wast')
+ subprocess.check_call(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ assert os.path.exists('a.wast')
+ actual = open('a.wast').read()
+ binary_file = wast + '.fromBinary'
+ if not debug_info:
+ binary_file += '.noDebugInfo'
+ with open(binary_file, 'w') as o:
+ print('writey', binary_file)
+ o.write(actual)