diff options
author | Alon Zakai <alonzakai@gmail.com> | 2015-12-06 16:11:58 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2015-12-06 16:11:58 -0800 |
commit | 72bca2037dd1699132e34c17d4b55ba29bafacf6 (patch) | |
tree | f0ba7fa7b127f154f8cf88c15e480d841205c715 | |
parent | 3e5ee789acecd01c092d9c834530f3ee2bf382c8 (diff) | |
download | binaryen-72bca2037dd1699132e34c17d4b55ba29bafacf6.tar.gz binaryen-72bca2037dd1699132e34c17d4b55ba29bafacf6.tar.bz2 binaryen-72bca2037dd1699132e34c17d4b55ba29bafacf6.zip |
verify wasm2asm emits valid js
-rwxr-xr-x | check.py | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -74,7 +74,7 @@ for asm in tests: raise Exception('wasm interpreter error: ' + err) # failed to pretty-print raise Exception('wasm interpreter error') -print '\n[ checking wasm2asm testcases... ]\n' +print '\n[ checking wasm2asm testcases... (need nodejs in your path) ]\n' for wasm in ['min.wast', 'hello_world.wast', 'unit.wast', 'emcc_O2_hello_world.wast']: if wasm.endswith('.wast'): @@ -92,6 +92,13 @@ for wasm in ['min.wast', 'hello_world.wast', 'unit.wast', 'emcc_O2_hello_world.w if actual != expected: fail(actual, expected) + # verify asm.js is valid js + open('a.2asm.js', 'w').write(actual) + proc = subprocess.Popen(['nodejs', 'a.2asm.js'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out, err = proc.communicate() + assert proc.returncode == 0 + assert not out and not err, [out, err] + print '\n[ checking binaryen-shell... ]\n' actual, err = subprocess.Popen([os.path.join('bin', 'binaryen-shell'), '--help'], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() |