aboutsummaryrefslogtreecommitdiff
path: root/src/internal/testenv
diff options
context:
space:
mode:
authorJohan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>2023-03-25 09:03:15 -0700
committerGopher Robot <gobot@golang.org>2023-04-07 23:34:17 +0000
commitdd21a77bfae041eefe7b02ab5a40a7c4d3403f8d (patch)
tree1a2f443e2daf2373b02ec7729f46d1baca315e6a /src/internal/testenv
parent693a34e78856980b0bb4a10ffcfd2bac1dbd6ebe (diff)
downloadgo-dd21a77bfae041eefe7b02ab5a40a7c4d3403f8d.tar.xz
internal: add wasip1 support
For #58141 Co-authored-by: Richard Musiol <neelance@gmail.com> Co-authored-by: Achille Roussel <achille.roussel@gmail.com> Co-authored-by: Julien Fabre <ju.pryz@gmail.com> Co-authored-by: Evan Phoenix <evan@phx.io> Change-Id: I1488726e5b43cd21c5f83900476afd2fb63d70c9 Reviewed-on: https://go-review.googlesource.com/c/go/+/479622 Auto-Submit: Ian Lance Taylor <iant@google.com> Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/internal/testenv')
-rw-r--r--src/internal/testenv/exec.go2
-rw-r--r--src/internal/testenv/testenv.go9
-rw-r--r--src/internal/testenv/testenv_notunix.go2
3 files changed, 7 insertions, 6 deletions
diff --git a/src/internal/testenv/exec.go b/src/internal/testenv/exec.go
index 77de59c70a..ec2f2e295c 100644
--- a/src/internal/testenv/exec.go
+++ b/src/internal/testenv/exec.go
@@ -20,7 +20,7 @@ import (
// using os.StartProcess or (more commonly) exec.Command.
func HasExec() bool {
switch runtime.GOOS {
- case "js", "ios":
+ case "wasip1", "js", "ios":
return false
}
return true
diff --git a/src/internal/testenv/testenv.go b/src/internal/testenv/testenv.go
index 565230e24c..9a649e037c 100644
--- a/src/internal/testenv/testenv.go
+++ b/src/internal/testenv/testenv.go
@@ -46,7 +46,7 @@ func HasGoBuild() bool {
return false
}
switch runtime.GOOS {
- case "android", "js", "ios":
+ case "android", "js", "ios", "wasip1":
return false
}
return true
@@ -80,6 +80,7 @@ func MustHaveGoRun(t testing.TB) {
// HasParallelism reports whether the current system can execute multiple
// threads in parallel.
+// There is a copy of this function in cmd/dist/test.go.
func HasParallelism() bool {
switch runtime.GOOS {
case "js", "wasip1":
@@ -257,14 +258,14 @@ func HasSrc() bool {
// HasExternalNetwork reports whether the current system can use
// external (non-localhost) networks.
func HasExternalNetwork() bool {
- return !testing.Short() && runtime.GOOS != "js"
+ return !testing.Short() && runtime.GOOS != "js" && runtime.GOOS != "wasip1"
}
// MustHaveExternalNetwork checks that the current system can use
// external (non-localhost) networks.
// If not, MustHaveExternalNetwork calls t.Skip with an explanation.
func MustHaveExternalNetwork(t testing.TB) {
- if runtime.GOOS == "js" {
+ if runtime.GOOS == "js" || runtime.GOOS == "wasip1" {
t.Skipf("skipping test: no external network on %s", runtime.GOOS)
}
if testing.Short() {
@@ -372,7 +373,7 @@ func SkipFlakyNet(t testing.TB) {
// CPUIsSlow reports whether the CPU running the test is suspected to be slow.
func CPUIsSlow() bool {
switch runtime.GOARCH {
- case "arm", "mips", "mipsle", "mips64", "mips64le":
+ case "arm", "mips", "mipsle", "mips64", "mips64le", "wasm":
return true
}
return false
diff --git a/src/internal/testenv/testenv_notunix.go b/src/internal/testenv/testenv_notunix.go
index 9313c7c827..31abe8d092 100644
--- a/src/internal/testenv/testenv_notunix.go
+++ b/src/internal/testenv/testenv_notunix.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build windows || plan9 || (js && wasm)
+//go:build windows || plan9 || (js && wasm) || wasip1
package testenv