From ff88392d8cdf08361686257c681a7bed4c0e0a7a Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Tue, 23 Apr 2019 01:23:41 +0200 Subject: [PATCH] Make the WASI backend configurable --- test/default/wasi-test-wrapper.sh | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/test/default/wasi-test-wrapper.sh b/test/default/wasi-test-wrapper.sh index 30b4950c..a98eed0a 100755 --- a/test/default/wasi-test-wrapper.sh +++ b/test/default/wasi-test-wrapper.sh @@ -1,14 +1,22 @@ #! /bin/sh -if command -v wasmtime >/dev/null; then - wasmtime -o --dir=. "$1" && exit 0 +if [ -z "$WASI_RUNTIME" ] || [ "$WASI_RUNTIME" = "wasmtime" ]; then + if command -v wasmtime >/dev/null; then + wasmtime -o --dir=. "$1" && exit 0 + fi fi -if command -v wasmer >/dev/null; then - wasmer run "$1" --dir=. && exit 0 +if [ -z "$WASI_RUNTIME" ] || [ "$WASI_RUNTIME" = "wasmer" ]; then + if command -v wasmer >/dev/null; then + wasmer run "$1" --backend "${WASMER_BACKEND:-cranelift}" --dir=. && exit 0 + fi fi -if command -v lucetc-wasi >/dev/null && command -v lucet-wasi >/dev/null; then - lucetc-wasi \ - --min-reserved-size "128MiB" \ - -o "${1}.so" --opt-level best "$1" && - lucet-wasi --dir=.:. "$1.so" && exit 0 +if [ -z "$WASI_RUNTIME" ] || [ "$WASI_RUNTIME" = "lucet" ]; then + if command -v lucetc-wasi >/dev/null && command -v lucet-wasi >/dev/null; then + lucetc-wasi \ + --min-reserved-size "128MiB" \ + -o "${1}.so" --opt-level best "$1" && + lucet-wasi --dir=.:. "$1.so" && exit 0 + fi fi +echo "WebAssembly runtime failed" >&2 +exit 1