diff options
author | Lucas Werkmeister | 2020-11-17 21:54:42 +0100 |
---|---|---|
committer | Lucas Werkmeister | 2020-11-17 21:54:42 +0100 |
commit | 4900009ab7455050557f35b379a7541a5e800356 (patch) | |
tree | 6ddda9c38df4a6921a8fd17a871bafdaa718813d | |
parent | e8b20aff1ea89ebabcf7db134675a6f0929dcb89 (diff) | |
download | aur-4900009ab7455050557f35b379a7541a5e800356.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.' |