summaryrefslogtreecommitdiff
path: root/auto_update_tests.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2017-10-03 15:20:42 -0700
committerGitHub <noreply@github.com>2017-10-03 15:20:42 -0700
commit7c491995ea89685f1381bd37227857820dbc0a34 (patch)
tree52c44bcdefe8eea33a33d227761475f2718eba12 /auto_update_tests.py
parent47c37d0c4457ede9f4343abca0d56e2baa7f3d8a (diff)
downloadbinaryen-7c491995ea89685f1381bd37227857820dbc0a34.tar.gz
binaryen-7c491995ea89685f1381bd37227857820dbc0a34.tar.bz2
binaryen-7c491995ea89685f1381bd37227857820dbc0a34.zip
Flattening rewrite (#1201)
Rename flatten-control-flow to flatten, which now flattens everything, not just control flow, so e.g. (i32.add (call $x) (call $y) ) ==> (block (set_local $temp_x (call $x)) (set_local $temp_y (call $y)) (i32.add (get_local $x) (get_local $y) ) ) This uses more locals than before, but is much simpler and avoids a bunch of corner cases and fuzz bugs the old one hit. We can optimize later if necessary.
Diffstat (limited to 'auto_update_tests.py')
-rwxr-xr-xauto_update_tests.py31
1 files changed, 17 insertions, 14 deletions
diff --git a/auto_update_tests.py b/auto_update_tests.py
index 47060edfe..93fe732d7 100755
--- a/auto_update_tests.py
+++ b/auto_update_tests.py
@@ -7,7 +7,7 @@ from scripts.test.shared import (
ASM2WASM, MOZJS, S2WASM, WASM_SHELL, WASM_OPT, WASM_AS, WASM_DIS,
WASM_CTOR_EVAL, WASM_MERGE, WASM_REDUCE, WASM2ASM,
BINARYEN_INSTALL_DIR, has_shell_timeout)
-from scripts.test.wasm2asm import tests, spec_tests, extra_tests
+from scripts.test.wasm2asm import tests, spec_tests, extra_tests, assert_tests
print '[ processing and updating testcases... ]\n'
@@ -64,19 +64,6 @@ for dot_s_dir in ['dot_s', 'llvm_autogenerated']:
expected_file = os.path.join('test', dot_s_dir, wasm)
with open(expected_file, 'w') as o: o.write(actual)
-'''
-for wasm in ['address.wast']:#os.listdir(os.path.join('test', 'spec')):
- if wasm.endswith('.wast'):
- print '..', wasm
- asm = wasm.replace('.wast', '.2asm.js')
- proc = subprocess.Popen([os.path.join('bin', 'wasm2asm'), os.path.join('test', 'spec', wasm)], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- actual, err = proc.communicate()
- assert proc.returncode == 0, err
- assert err == '', 'bad err:' + err
- expected_file = os.path.join('test', asm)
- open(expected_file, 'w').write(actual)
-'''
-
for t in sorted(os.listdir(os.path.join('test', 'print'))):
if t.endswith('.wast'):
print '..', t
@@ -281,6 +268,22 @@ for wasm in tests + spec_tests + extra_tests:
out = run_command(cmd)
with open(expected_file, 'w') as o: o.write(out)
+for wasm in assert_tests:
+ print '..', wasm
+
+ asserts = os.path.basename(wasm).replace('.wast.asserts', '.asserts.js')
+ traps = os.path.basename(wasm).replace('.wast.asserts', '.traps.js')
+ asserts_expected_file = os.path.join('test', asserts)
+ traps_expected_file = os.path.join('test', traps)
+
+ cmd = WASM2ASM + [os.path.join('test', wasm), '--allow-asserts']
+ out = run_command(cmd)
+ with open(asserts_expected_file, 'w') as o: o.write(out)
+
+ cmd += ['--pedantic']
+ out = run_command(cmd)
+ with open(traps_expected_file, 'w') as o: o.write(out)
+
if has_shell_timeout():
print '\n[ checking wasm-reduce ]\n'