From 7c491995ea89685f1381bd37227857820dbc0a34 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 3 Oct 2017 15:20:42 -0700 Subject: 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. --- auto_update_tests.py | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'auto_update_tests.py') 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' -- cgit v1.2.3