2019-04-08 12:45:08 -07:00
|
|
|
#! /bin/sh
|
|
|
|
|
2019-05-21 02:22:49 -07:00
|
|
|
MAX_MEMORY_TESTS="67108864"
|
2019-04-22 18:14:19 -07:00
|
|
|
|
2019-10-22 08:16:54 -07:00
|
|
|
if command -v wasm-opt >/dev/null; then
|
|
|
|
wasm-opt -O4 -o "${1}.tmp" "$1" && mv -f "${1}.tmp" "$1"
|
|
|
|
fi
|
|
|
|
|
2019-10-21 23:59:24 -07:00
|
|
|
if [ -z "$WASI_RUNTIME" ] || [ "$WASI_RUNTIME" = "wavm" ]; then
|
|
|
|
if command -v wavm >/dev/null; then
|
|
|
|
wavm run --abi=wasi "$1" && exit 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2019-04-22 16:23:41 -07:00
|
|
|
if [ -z "$WASI_RUNTIME" ] || [ "$WASI_RUNTIME" = "wasmtime" ]; then
|
|
|
|
if command -v wasmtime >/dev/null; then
|
|
|
|
wasmtime -o --dir=. "$1" && exit 0
|
|
|
|
fi
|
2019-04-22 14:53:43 -07:00
|
|
|
fi
|
2019-04-22 16:24:12 -07:00
|
|
|
|
2019-10-11 08:31:57 -07:00
|
|
|
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
|
|
|
|
|
2019-11-04 18:08:15 -07:00
|
|
|
if [ -z "$WASI_RUNTIME" ] || [ "$WASI_RUNTIME" = "wasmer-js" ]; then
|
|
|
|
if command -v wasmer-js >/dev/null; then
|
|
|
|
wasmer-js run "$1" --dir=. && exit 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2019-04-22 16:23:41 -07:00
|
|
|
echo "WebAssembly runtime failed" >&2
|
|
|
|
exit 1
|