summaryrefslogtreecommitdiff
path: root/check.py
diff options
context:
space:
mode:
Diffstat (limited to 'check.py')
-rwxr-xr-xcheck.py27
1 files changed, 13 insertions, 14 deletions
diff --git a/check.py b/check.py
index d7a827e6b..725766aa6 100755
--- a/check.py
+++ b/check.py
@@ -358,25 +358,24 @@ def run_binaryen_js_tests():
if not s.endswith('.js'): continue
print s
f = open('a.js', 'w')
- f.write(open(os.path.join(options.binaryen_bin, 'binaryen.js')).read())
- # node test support
- f.write('\nif (typeof require === "function") var Binaryen = module.exports;\n')
+ binaryen_js = open(os.path.join(options.binaryen_bin, 'binaryen.js')).read()
+ f.write(binaryen_js)
test_path = os.path.join(options.binaryen_test, 'binaryen.js', s)
test = open(test_path).read()
need_wasm = 'WebAssembly.' in test # some tests use wasm support in the VM
- if MOZJS:
- cmd = [MOZJS]
- elif NODEJS and not need_wasm: # TODO: check if node is new and has wasm support
- cmd = [NODEJS]
- else:
- continue # we can't run it
- cmd += ['a.js']
f.write(test)
f.close()
- out = run_command(cmd, stderr=subprocess.STDOUT)
- expected = open(os.path.join(options.binaryen_test, 'binaryen.js', s + '.txt')).read()
- if expected not in out:
- fail(out, expected)
+ def test(engine):
+ cmd = [engine, 'a.js']
+ out = run_command(cmd, stderr=subprocess.STDOUT)
+ expected = open(os.path.join(options.binaryen_test, 'binaryen.js', s + '.txt')).read()
+ if expected not in out:
+ fail(out, expected)
+ # run in all possible shells
+ if MOZJS:
+ test(MOZJS)
+ if NODEJS and not need_wasm: # TODO: check if node is new and has wasm support
+ test(NODEJS)
def run_validator_tests():
print '\n[ running validation tests... ]\n'