summaryrefslogtreecommitdiff
path: root/auto_update_tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'auto_update_tests.py')
-rwxr-xr-xauto_update_tests.py25
1 files changed, 16 insertions, 9 deletions
diff --git a/auto_update_tests.py b/auto_update_tests.py
index 2abc4a4a9..c2cdc1601 100755
--- a/auto_update_tests.py
+++ b/auto_update_tests.py
@@ -2,9 +2,9 @@
import os, sys, subprocess, difflib
-from scripts.test.support import run_command, split_wast
+from scripts.test.support import run_command, split_wast, node_test_glue, node_has_webassembly
from scripts.test.shared import (
- ASM2WASM, MOZJS, S2WASM, WASM_SHELL, WASM_OPT, WASM_AS, WASM_DIS,
+ ASM2WASM, MOZJS, NODEJS, S2WASM, WASM_SHELL, WASM_OPT, WASM_AS, WASM_DIS,
WASM_CTOR_EVAL, WASM_MERGE, WASM_REDUCE, WASM2ASM, WASM_METADCE,
BINARYEN_INSTALL_DIR, has_shell_timeout)
from scripts.test.wasm2asm import tests, spec_tests, extra_tests, assert_tests
@@ -231,20 +231,27 @@ for t in os.listdir(os.path.join('test', 'merge')):
with open(out, 'w') as o: o.write(actual)
with open(out + '.stdout', 'w') as o: o.write(stdout)
-if MOZJS:
+if MOZJS or NODEJS:
print '\n[ checking binaryen.js testcases... ]\n'
+ node_has_wasm = NODEJS and node_has_webassembly(NODEJS)
for s in sorted(os.listdir(os.path.join('test', 'binaryen.js'))):
if not s.endswith('.js'): continue
print s
f = open('a.js', 'w')
f.write(open(os.path.join('bin', 'binaryen.js')).read())
- # node/shell test support
- f.write(open(os.path.join('test', 'binaryen.js', s)).read())
+ if NODEJS:
+ f.write(node_test_glue())
+ test_path = os.path.join('test', 'binaryen.js', s)
+ test_src = open(test_path).read()
+ f.write(test_src)
f.close()
- cmd = [MOZJS, 'a.js']
- out = run_command(cmd, stderr=subprocess.STDOUT)
- with open(os.path.join('test', 'binaryen.js', s + '.txt'), 'w') as o: o.write(out)
+ if MOZJS or node_has_wasm or not 'WebAssembly.' in test_src:
+ cmd = [MOZJS or NODEJS, 'a.js']
+ out = run_command(cmd, stderr=subprocess.STDOUT)
+ with open(os.path.join('test', 'binaryen.js', s + '.txt'), 'w') as o: o.write(out)
+ else:
+ print 'Skipping ' + test_path + ' because WebAssembly might not be supported'
print '\n[ checking wasm-ctor-eval... ]\n'
@@ -320,4 +327,4 @@ if has_shell_timeout():
expected = t + '.txt'
run_command(WASM_DIS + ['c.wasm', '-o', expected])
-print '\n[ success! ]'
+print '\n[ success! ]'