diff options
| author | Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com> | 2023-03-24 23:11:55 -0700 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2023-04-06 17:48:24 +0000 |
| commit | be50055eef0f460695adb8db2b130392dc367fe7 (patch) | |
| tree | de5f16a5f94368df7f74c1eb648e159841c2bafd /src/internal/testenv | |
| parent | c02fa75086dbc6db0d90f477e7b4c839140fdeb2 (diff) | |
| download | go-be50055eef0f460695adb8db2b130392dc367fe7.tar.xz | |
runtime: add remaining wasip1 files
Implements OS interactions and memory management.
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: I876e7b033090c2fe2d76d2535bb63d52efa36185
Reviewed-on: https://go-review.googlesource.com/c/go/+/479618
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/internal/testenv')
| -rw-r--r-- | src/internal/testenv/testenv.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/internal/testenv/testenv.go b/src/internal/testenv/testenv.go index 94cec0b8bd..565230e24c 100644 --- a/src/internal/testenv/testenv.go +++ b/src/internal/testenv/testenv.go @@ -78,6 +78,24 @@ func MustHaveGoRun(t testing.TB) { } } +// HasParallelism reports whether the current system can execute multiple +// threads in parallel. +func HasParallelism() bool { + switch runtime.GOOS { + case "js", "wasip1": + return false + } + return true +} + +// MustHaveParallelism checks that the current system can execute multiple +// threads in parallel. If not, MustHaveParallelism calls t.Skip with an explanation. +func MustHaveParallelism(t testing.TB) { + if !HasParallelism() { + t.Skipf("skipping test: no parallelism available on %s/%s", runtime.GOOS, runtime.GOARCH) + } +} + // GoToolPath reports the path to the Go tool. // It is a convenience wrapper around GoTool. // If the tool is unavailable GoToolPath calls t.Skip. |
