summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2015-12-06 16:11:58 -0800
committerAlon Zakai <alonzakai@gmail.com>2015-12-06 16:11:58 -0800
commit72bca2037dd1699132e34c17d4b55ba29bafacf6 (patch)
treef0ba7fa7b127f154f8cf88c15e480d841205c715
parent3e5ee789acecd01c092d9c834530f3ee2bf382c8 (diff)
downloadbinaryen-72bca2037dd1699132e34c17d4b55ba29bafacf6.tar.gz
binaryen-72bca2037dd1699132e34c17d4b55ba29bafacf6.tar.bz2
binaryen-72bca2037dd1699132e34c17d4b55ba29bafacf6.zip
verify wasm2asm emits valid js
-rwxr-xr-xcheck.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/check.py b/check.py
index 21e0267f7..a5d05a2c0 100755
--- a/check.py
+++ b/check.py
@@ -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()