diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-03-12 14:39:50 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-03-12 14:39:50 -0800 |
commit | 0cfe85c2d52a5cb5c64065d029375b005c9bc541 (patch) | |
tree | bab992a9a7ee8521e0023cc262eed9b3ae340a6d /check.py | |
parent | cb24663efde2d12d94e358d63d32b1cf97c4d342 (diff) | |
download | binaryen-0cfe85c2d52a5cb5c64065d029375b005c9bc541.tar.gz binaryen-0cfe85c2d52a5cb5c64065d029375b005c9bc541.tar.bz2 binaryen-0cfe85c2d52a5cb5c64065d029375b005c9bc541.zip |
add optional native wasm checking
Diffstat (limited to 'check.py')
-rwxr-xr-x | check.py | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -146,7 +146,7 @@ if not interpreter: if not has_node: warn('no node found (did not check proper js form)') if not has_mozjs: - warn('no mozjs found (did not check asm.js validation)') + warn('no mozjs found (did not check native wasm support nor asm.js validation)') if not has_emcc: warn('no emcc found (did not check non-vanilla emscripten/binaryen integration)') if not has_vanilla_emcc: @@ -566,6 +566,24 @@ if actual != expected: if has_emcc: + if has_mozjs: + + print '\n[ checking native wasm support ]\n' + + command = ['emcc', '-o', 'a.wasm.js', '-s', 'BINARYEN=1', os.path.join('test', 'hello_world.c'), '-s', 'BINARYEN_METHOD="native-wasm"', '-s', 'BINARYEN_SCRIPTS="spidermonkify.py"'] + print ' '.join(command) + subprocess.check_call(command) + + proc = subprocess.Popen(['mozjs', 'a.wasm.js'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out, err = proc.communicate() + assert proc.returncode == 0, err + assert 'hello, world!' in out, out + + proc = subprocess.Popen([has_node, 'a.wasm.js'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out, err = proc.communicate() + assert proc.returncode != 0, 'should fail on no wasm support' + assert 'no native wasm support detected' in err, err + print '\n[ checking wasm.js methods... ]\n' for method_init in [None, 'asm2wasm', 'wasm-s-parser', 'just-asm']: |