1
0
mirror of https://github.com/golang/go synced 2024-11-26 10:48:22 -07:00
go/misc/wasm/go_wasip1_wasm_exec
Johan Brandhorst-Satzkorn dc076eaf2e misc/wasm: add wasmedge to wasip1 script
The wasmedge runtime will be used to test our wasip1
implementation against the WASI runtime from wasmedge.org.

For #60097

Change-Id: Ib0e886de46240b4d43d02ec8a7bc7cea0730c162
Reviewed-on: https://go-review.googlesource.com/c/go/+/494120
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
2023-05-11 14:42:30 +00:00

24 lines
650 B
Bash
Executable File

#!/usr/bin/env bash
# Copyright 2023 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
case "$GOWASIRUNTIME" in
"wasmedge")
exec wasmedge --dir=/ --env PWD="$PWD" "$1" "${@:2}"
;;
"wasmer")
exec wasmer run --dir=/ --env PWD="$PWD" "$1" -- "${@:2}"
;;
"wasmtime")
exec wasmtime run --dir=/ --env PWD="$PWD" --max-wasm-stack 1048576 "$1" -- "${@:2}"
;;
"wazero" | "")
exec wazero run -mount /:/ -env-inherit -cachedir "${TMPDIR:-/tmp}"/wazero "$1" "${@:2}"
;;
*)
echo "Unknown Go WASI runtime specified: $GOWASIRUNTIME"
exit 1
;;
esac