Blame SOURCES/libsodium-1.0.18/test/default/wasi-test-wrapper.sh

ca16be
#! /bin/sh
ca16be
ca16be
MAX_MEMORY_TESTS="67108864"
ca16be
ca16be
if [ -z "$WASI_RUNTIME" ] || [ "$WASI_RUNTIME" = "wasmtime" ]; then
ca16be
  if command -v wasmtime >/dev/null; then
ca16be
    wasmtime -o --dir=. "$1" && exit 0
ca16be
  fi
ca16be
fi
ca16be
ca16be
if [ -z "$WASI_RUNTIME" ] || [ "$WASI_RUNTIME" = "lucet" ]; then
ca16be
  if command -v lucetc-wasi >/dev/null && command -v lucet-wasi >/dev/null; then
ca16be
    lucetc-wasi \
ca16be
      --reserved-size "${MAX_MEMORY_TESTS}" \
ca16be
      -o "${1}.so" --opt-level fast "$1" &&
ca16be
      lucet-wasi --dir=.:. --max-heap-size "${MAX_MEMORY_TESTS}" "${1}.so" &&
ca16be
      rm -f "${1}.so" && exit 0
ca16be
  fi
ca16be
fi
ca16be
ca16be
if [ -z "$WASI_RUNTIME" ] || [ "$WASI_RUNTIME" = "wasmer" ]; then
ca16be
  if command -v wasmer >/dev/null; then
ca16be
    wasmer run "$1" --backend "${WASMER_BACKEND:-cranelift}" --dir=. && exit 0
ca16be
  fi
ca16be
fi
ca16be
ca16be
echo "WebAssembly runtime failed" >&2
ca16be
exit 1