From 0cfe85c2d52a5cb5c64065d029375b005c9bc541 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Sat, 12 Mar 2016 14:39:50 -0800 Subject: add optional native wasm checking --- check.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'check.py') diff --git a/check.py b/check.py index 744042393..ff85449c7 100755 --- a/check.py +++ b/check.py @@ -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']: -- cgit v1.2.3