Skip to content

Commit 1c17981

Browse files
misc/wasm: support wasmtime in wasip1
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 <[email protected]> TryBot-Bypass: Johan Brandhorst-Satzkorn <[email protected]> Run-TryBot: Johan Brandhorst-Satzkorn <[email protected]> Reviewed-by: Cherry Mui <[email protected]>
1 parent 3088639 commit 1c17981

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

misc/wasm/go_wasip1_wasm_exec

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,15 @@
33
# Use of this source code is governed by a BSD-style
44
# license that can be found in the LICENSE file.
55

6-
exec wazero run -mount /:/ -env-inherit -cachedir "${TMPDIR}"/wazero $1 "${@:2}"
6+
case "$GOWASIRUNTIME" in
7+
"wasmtime")
8+
exec wasmtime run --dir=/ --env PWD="$PWD" --max-wasm-stack 1048576 "$1" -- "${@:2}"
9+
;;
10+
"wazero" | "")
11+
exec wazero run -mount /:/ -env-inherit -cachedir "${TMPDIR}"/wazero "$1" "${@:2}"
12+
;;
13+
*)
14+
echo "Unknown Go WASI runtime specified: $GOWASIRUNTIME"
15+
exit 1
16+
;;
17+
esac

0 commit comments

Comments
 (0)