From f587c3b49c52adf244f1fc2844e0a0d701ca21b5 Mon Sep 17 00:00:00 2001 From: Folkert Date: Fri, 8 Apr 2022 14:33:10 +0200 Subject: [PATCH] update zig wasm test runner script --- compiler/builtins/bitcode/run-wasm-tests.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/compiler/builtins/bitcode/run-wasm-tests.sh b/compiler/builtins/bitcode/run-wasm-tests.sh index 278a1e618b..42874cc26e 100755 --- a/compiler/builtins/bitcode/run-wasm-tests.sh +++ b/compiler/builtins/bitcode/run-wasm-tests.sh @@ -4,6 +4,10 @@ set -euxo pipefail # Test failures will always point at the _start function # Make sure to look at the rest of the stack trace! -warning_about_non_native_binary=$(zig test -target wasm32-wasi-musl -O ReleaseFast src/main.zig 2>&1) -wasm_test_binary=$(echo $warning_about_non_native_binary | cut -d' ' -f 3) + +# Zig will try to run the test binary it produced, but it is a wasm object and hence your OS won't +# know how to run it. In the error message, it prints the binary it tried to run. We use some fun +# unix tools to get that path, then feed it to wasmer +warning_about_non_native_binary=$(zig test -target wasm32-wasi-musl -O ReleaseFast src/main.zig 2>&1) || true +wasm_test_binary=$(echo $warning_about_non_native_binary | cut -d' ' -f 35 ) wasmer $wasm_test_binary dummyArgForZigTestBinary