summaryrefslogtreecommitdiff
path: root/scripts/test
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2020-08-20 14:00:18 -0700
committerGitHub <noreply@github.com>2020-08-20 14:00:18 -0700
commit70e855b30114853b86f0947f49cb5a77ddad6aa9 (patch)
treecba31c592a2b97f9432b1c9485019f7fd22c11f2 /scripts/test
parentaf87f23744477b034dcb1c59af2a1a208becab23 (diff)
downloadbinaryen-70e855b30114853b86f0947f49cb5a77ddad6aa9.tar.gz
binaryen-70e855b30114853b86f0947f49cb5a77ddad6aa9.tar.bz2
binaryen-70e855b30114853b86f0947f49cb5a77ddad6aa9.zip
Harmonize auto updater with test runner: wasm-opt should update .fromBinary outputs (#3066)
It was confusing that you had to run ./auto_update_tests.py binfmt to update a test checked by ./check.py wasm-opt. Instead, make ./auto_update_tests.py wasm-opt update those, so it's symmetrical.
Diffstat (limited to 'scripts/test')
-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)