Skip to content

Commit

Permalink
misc/wasm: support wasmtime in wasip1
Browse files Browse the repository at this point in the history
Allow switching to wasmtime through the GOWASIRUNTIME variable. This
will allow builders to run the wasip1 standard library tests against
the wasmtime WASI runtime.

For #59583

Change-Id: I4d5200df7bb27b66e041f00e89d4c2e585f5da7c
Reviewed-on: https://go-review.googlesource.com/c/go/+/485615
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Bypass: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
  • Loading branch information
johanbrandhorst committed Apr 21, 2023
1 parent 3088639 commit 1c17981
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion misc/wasm/go_wasip1_wasm_exec
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,15 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.

exec wazero run -mount /:/ -env-inherit -cachedir "${TMPDIR}"/wazero $1 "${@:2}"
case "$GOWASIRUNTIME" in
"wasmtime")
exec wasmtime run --dir=/ --env PWD="$PWD" --max-wasm-stack 1048576 "$1" -- "${@:2}"
;;
"wazero" | "")
exec wazero run -mount /:/ -env-inherit -cachedir "${TMPDIR}"/wazero "$1" "${@:2}"
;;
*)
echo "Unknown Go WASI runtime specified: $GOWASIRUNTIME"
exit 1
;;
esac

0 comments on commit 1c17981

Please sign in to comment.