From 84bb319442fc0bc333924679e910c5a3475ca236 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 30 Mar 2016 15:37:22 -0700 Subject: update emscripten submodule --- test/emscripten | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/emscripten b/test/emscripten index 4dae3d922..c7b7edf20 160000 --- a/test/emscripten +++ b/test/emscripten @@ -1 +1 @@ -Subproject commit 4dae3d92279887e64f2afdb60c162ecd4feab8a1 +Subproject commit c7b7edf205c93b80d8e34c3e7f9100eb41b7c383 -- cgit v1.2.3 From bb124a9d8bf891d2482600396a7495f3051a3455 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 30 Mar 2016 17:01:51 -0700 Subject: avoid hardcoded function pointer addresses in indirect_call.cpp test --- test/wasm_backend/indirect_call.cpp | 4 ++-- test/wasm_backend/indirect_call.txt | 8 -------- 2 files changed, 2 insertions(+), 10 deletions(-) (limited to 'test') diff --git a/test/wasm_backend/indirect_call.cpp b/test/wasm_backend/indirect_call.cpp index 75c459199..ef52a4ad1 100644 --- a/test/wasm_backend/indirect_call.cpp +++ b/test/wasm_backend/indirect_call.cpp @@ -37,13 +37,13 @@ int main(int argc, char **argv) { for (int i = 0; i < 4 && i < argc*4; i++) { print("i", i); v curr = f1[i]; - print("curr address to call", (int)curr); + //print("curr address to call", (int)curr); curr(); } vi f2[4] = { other, yet, other, yet }; for (int i = 0; i < 4 && i < argc*4; i++) { vi curr = f2[i]; - print("curr", (int)curr); + //print("curr", (int)curr); curr(i); } } diff --git a/test/wasm_backend/indirect_call.txt b/test/wasm_backend/indirect_call.txt index 8d60cc1ff..8e10834ad 100644 --- a/test/wasm_backend/indirect_call.txt +++ b/test/wasm_backend/indirect_call.txt @@ -2,22 +2,14 @@ print: argc : 1 print: addr of something : 0 print: addr of more : 1 print: i : 0 -print: curr address to call : 0 print: something : 12 print: i : 1 -print: curr address to call : 1 print: more : -1 print: i : 2 -print: curr address to call : 0 print: something : 12 print: i : 3 -print: curr address to call : 1 print: more : -1 -print: curr : 2 print: other : 40 -print: curr : 3 print: yet : 100 -print: curr : 2 print: other : 42 -print: curr : 3 print: yet : 102 -- cgit v1.2.3 From 57275446a9cca19ab58bb937753cf75cbd1481fb Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 30 Mar 2016 17:05:46 -0700 Subject: add testing for vanilla llvm + emcc without the hacks, as things are now starting to work, and add a full/real hello world testcase --- check.py | 24 +++++++++++++----------- test/wasm_backend/hello_world_real.cpp | 6 ++++++ test/wasm_backend/hello_world_real.txt | 1 + 3 files changed, 20 insertions(+), 11 deletions(-) create mode 100644 test/wasm_backend/hello_world_real.cpp create mode 100644 test/wasm_backend/hello_world_real.txt (limited to 'test') diff --git a/check.py b/check.py index a1f11acaf..e5f33610e 100755 --- a/check.py +++ b/check.py @@ -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 + +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! -- cgit v1.2.3