From c733dd24ba5df55272feb4880fe302bed42d5568 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Mon, 21 Mar 2016 11:38:10 -0700 Subject: use binary_format_check on asm2wasm outputs --- check.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'check.py') diff --git a/check.py b/check.py index d27fd5324..a1f11acaf 100755 --- a/check.py +++ b/check.py @@ -266,29 +266,31 @@ print '[ checking asm2wasm testcases... ]\n' for asm in tests: if asm.endswith('.asm.js'): - wasm = asm.replace('.asm.js', '.fromasm') cmd = [os.path.join('bin', 'asm2wasm'), os.path.join('test', asm)] for precise in [1, 0]: + wasm = asm.replace('.asm.js', '.fromasm') if not precise: cmd += ['--imprecise'] wasm += '.imprecise' + wasm = os.path.join('test', wasm) print '..', asm, wasm print ' ', ' '.join(cmd) actual, err = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() assert err == '', 'bad err:' + err # verify output - if not os.path.exists(os.path.join('test', wasm)): - print actual - raise Exception('output .wast file does not exist') - expected = open(os.path.join('test', wasm)).read() + if not os.path.exists(wasm): + raise Exception('output .wast file %s does not exist' % wasm) + expected = open(wasm).read() if actual != expected: fail(actual, expected) + binary_format_check(wasm, verify_final_result=False) + # verify in wasm if interpreter: # remove imports, spec interpreter doesn't know what to do with them - subprocess.check_call([os.path.join('bin', 'binaryen-shell'), '--remove-imports', '--print', os.path.join('test', wasm)], stdout=open('ztemp.wast', 'w'), stderr=subprocess.PIPE) + subprocess.check_call([os.path.join('bin', 'binaryen-shell'), '--remove-imports', '--print', wasm], stdout=open('ztemp.wast', 'w'), stderr=subprocess.PIPE) proc = subprocess.Popen([interpreter, 'ztemp.wast'], stderr=subprocess.PIPE) out, err = proc.communicate() if proc.returncode != 0: -- cgit v1.2.3