diff options
author | Lucas Werkmeister | 2020-11-17 21:51:53 +0100 |
---|---|---|
committer | Lucas Werkmeister | 2020-11-17 21:51:53 +0100 |
commit | 5fe89559c79a237c6c00e49f85e0191b04175c9e (patch) | |
tree | e123f08e7256805a9eae77502dc9ba0ed421272a | |
parent | 04695ea22e7a08021078c963c636ed9966718f2c (diff) | |
download | aur-5fe89559c79a237c6c00e49f85e0191b04175c9e.tar.gz |
Add GraalWasm to test.sh script
Needs Emscripten to compile the C file, which apparently puts the emcc
binary in an unusual location, so add that to the PATH as well. I also
considered adding the .wasm file to the Git repository directly, but it
seems the format changes occasionally – a file I used to test earlier
GraalWasm releases didn’t work with 20.3.0 anymore – so let’s instead
have the test script compile the source code from scratch, and require
the testing user to have emscripten installed.
-rwxr-xr-x | test.sh | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -49,4 +49,24 @@ if [[ $helloWorld != 'Hello, world!' ]]; then exit 1 fi +printf '%s\n' 'Testing GraalWASM...' + +PATH=$PATH:/usr/lib/emscripten + +cat > hello.c << 'EOF' +#include <stdio.h> + +int main() { + printf("Hello, WASM!\n"); + return 0; +} +EOF +emcc -o hello.wasm hello.c || exit + +helloWorld=$(wasm --Builtins=wasi_snapshot_preview1 hello.wasm) || exit +if [[ $helloWorld != 'Hello, WASM!' ]]; then + printf 'expected "Hello, WASM!", got %q\n' "$helloWorld" + exit 1 +fi + printf '%s\n' 'Done.' |