aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorDamian Gryski <[email protected]>2024-07-02 07:02:03 -0700
committerGitHub <[email protected]>2024-07-02 07:02:03 -0700
commit9cb263479c4b98f2d28889ca1acc297454e0d875 (patch)
treea30bcf8ef9086c5b8edfcee3b42bef352f396878 /tools
parentf18c6e342f834988caf43fd652b2baae9c3093f0 (diff)
downloadtinygo-9cb263479c4b98f2d28889ca1acc297454e0d875.tar.gz
tinygo-9cb263479c4b98f2d28889ca1acc297454e0d875.zip
wasi preview 2 support (#4027)
* all: wasip2 support Co-authored-by: Randy Reddig <[email protected]>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/tgtestjson.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/tgtestjson.sh b/tools/tgtestjson.sh
new file mode 100755
index 000000000..169da5852
--- /dev/null
+++ b/tools/tgtestjson.sh
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+
+# Run tests and convert output to json with go tool test2json.
+# This is a workaround for the lack of -json output in tinygo test.
+# Some variables must be set in the environment beforehand.
+# TODO: let's just add -json support to tinygo test.
+
+TINYGO="${TINYGO:-tinygo}"
+PACKAGES="${PACKAGES:-"./tests"}"
+TARGET="${TARGET:-wasip2}"
+TESTOPTS="${TESTOPTS:-"-x -work"}"
+
+# go clean -testcache
+for pkg in $PACKAGES; do
+ # Example invocation with test2json in BigGo:
+ # go test -test.v=test2json ./$pkg 2>&1 | go tool test2json -p $pkg
+
+ # Uncomment to see resolved commands in output
+ # >&2 echo "${TINYGO} test -v -target $TARGET $TESTOPTS $pkg 2>&1 | go tool test2json -p $pkg"
+ "${TINYGO}" test -v -target $TARGET $TESTOPTS $pkg 2>&1 | go tool test2json -p $pkg
+
+done