summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2015-12-07 15:28:00 -0800
committerAlon Zakai <alonzakai@gmail.com>2015-12-07 15:29:30 -0800
commitf9782b01cd76e76d5921a7e526e2e4577dbf29e4 (patch)
tree1f9afee63cd06a3848605cd769b35d4caedc53eb
parent567ac5040752e1e06910f97fe181b95f19e0613d (diff)
downloadbinaryen-f9782b01cd76e76d5921a7e526e2e4577dbf29e4.tar.gz
binaryen-f9782b01cd76e76d5921a7e526e2e4577dbf29e4.tar.bz2
binaryen-f9782b01cd76e76d5921a7e526e2e4577dbf29e4.zip
check asm.js validation in wasm2asm output
-rwxr-xr-xcheck.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/check.py b/check.py
index 1eab8c112..c04f1ee2b 100755
--- a/check.py
+++ b/check.py
@@ -127,14 +127,23 @@ for wasm in ['min.wast', 'hello_world.wast', 'unit.wast', 'emcc_O2_hello_world.w
if actual != expected:
fail(actual, expected)
+ open('a.2asm.js', 'w').write(actual)
+
if has_node:
# 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]
+ if has_mozjs:
+ # verify asm.js validates
+ open('a.2asm.js', 'w').write(actual)
+ proc = subprocess.Popen(['mozjs', '-w', 'a.2asm.js'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ out, err = proc.communicate()
+ assert proc.returncode == 0
+ fail_if_not_contained(err, 'Successfully compiled asm.js code')
+
print '\n[ checking binaryen-shell... ]\n'
actual, err = subprocess.Popen([os.path.join('bin', 'binaryen-shell'), '--help'], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()