diff options
-rwxr-xr-x | check.py | 24 | ||||
-rw-r--r-- | test/wasm_backend/hello_world_real.cpp | 6 | ||||
-rw-r--r-- | test/wasm_backend/hello_world_real.txt | 1 |
3 files changed, 20 insertions, 11 deletions
@@ -536,17 +536,19 @@ if has_vanilla_emcc and has_vanilla_llvm: print '..', c base = c.replace('.cpp', '').replace('.c', '') expected = open(os.path.join('test', 'wasm_backend', base + '.txt')).read() - command = [VANILLA_EMCC, '-o', 'a.wasm.js', '-s', 'BINARYEN=1', os.path.join('test', 'wasm_backend', c), '-O1', '-s', 'ONLY_MY_CODE=1'] - print '....' + ' '.join(command) - if os.path.exists('a.wasm.js'): os.unlink('a.wasm.js') - subprocess.check_call(command) - if has_node: - print ' (check in node)' - proc = subprocess.Popen([has_node, 'a.wasm.js'], stdout=subprocess.PIPE) - out, err = proc.communicate() - assert proc.returncode == 0 - if out.strip() != expected.strip(): - fail(out, expected) + for opts in [[], ['-O1'], ['-O2']]: + only = [] if opts != ['-O1'] or 'real' in base else ['-s', 'ONLY_MY_CODE=1'] # only my code is a hack we used early in wasm backend dev, which somehow worked, but only with -O1 + command = [VANILLA_EMCC, '-o', 'a.wasm.js', os.path.join('test', 'wasm_backend', c)] + opts + only + print '....' + ' '.join(command) + if os.path.exists('a.wasm.js'): os.unlink('a.wasm.js') + subprocess.check_call(command) + if has_node: + print ' (check in node)' + proc = subprocess.Popen([has_node, 'a.wasm.js'], stdout=subprocess.PIPE) + out, err = proc.communicate() + assert proc.returncode == 0 + if out.strip() != expected.strip(): + fail(out, expected) finally: if has_vanilla_llvm: del os.environ['LLVM'] diff --git a/test/wasm_backend/hello_world_real.cpp b/test/wasm_backend/hello_world_real.cpp new file mode 100644 index 000000000..1e39e8bd4 --- /dev/null +++ b/test/wasm_backend/hello_world_real.cpp @@ -0,0 +1,6 @@ +#include <stdio.h> + +int main() { + printf("hello, world!\n"); +} + diff --git a/test/wasm_backend/hello_world_real.txt b/test/wasm_backend/hello_world_real.txt new file mode 100644 index 000000000..270c611ee --- /dev/null +++ b/test/wasm_backend/hello_world_real.txt @@ -0,0 +1 @@ +hello, world! |