diff options
Diffstat (limited to 'check.py')
-rwxr-xr-x | check.py | 27 |
1 files changed, 13 insertions, 14 deletions
@@ -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' |