From b47ebb229fba8748366d52b6894a572da7c3ccfd Mon Sep 17 00:00:00 2001 From: qmuntal Date: Mon, 24 Feb 2025 10:21:01 +0100 Subject: all: use testenv.GoToolPath instead of hardcoding go Change-Id: I84ec73d3ddef913a87cb9b48147c44ac3e7c8a8d Reviewed-on: https://go-review.googlesource.com/c/go/+/651957 Reviewed-by: Ian Lance Taylor Reviewed-by: Michael Pratt LUCI-TryBot-Result: Go LUCI --- src/runtime/internal/wasitest/nonblock_test.go | 5 ++++- src/runtime/internal/wasitest/tcpecho_test.go | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/internal/wasitest/nonblock_test.go b/src/runtime/internal/wasitest/nonblock_test.go index 3072b96ed8..f5f6bb84d0 100644 --- a/src/runtime/internal/wasitest/nonblock_test.go +++ b/src/runtime/internal/wasitest/nonblock_test.go @@ -10,6 +10,7 @@ package wasi_test import ( "bufio" "fmt" + "internal/testenv" "io" "math/rand" "os" @@ -41,6 +42,8 @@ func TestNonblock(t *testing.T) { t.Skip("wasmer does not support non-blocking I/O") } + testenv.MustHaveGoRun(t) + for _, mode := range []string{"os.OpenFile", "os.NewFile"} { t.Run(mode, func(t *testing.T) { args := []string{"run", "./testdata/nonblock.go", mode} @@ -62,7 +65,7 @@ func TestNonblock(t *testing.T) { fifos[len(fifos)-i-1] = &fifo{file, path} } - subProcess := exec.Command("go", args...) + subProcess := exec.Command(testenv.GoToolPath(t), args...) subProcess.Env = append(os.Environ(), "GOOS=wasip1", "GOARCH=wasm") diff --git a/src/runtime/internal/wasitest/tcpecho_test.go b/src/runtime/internal/wasitest/tcpecho_test.go index bbcea90310..aa57d9e2e3 100644 --- a/src/runtime/internal/wasitest/tcpecho_test.go +++ b/src/runtime/internal/wasitest/tcpecho_test.go @@ -7,6 +7,7 @@ package wasi_test import ( "bytes" "fmt" + "internal/testenv" "math/rand" "net" "os" @@ -20,6 +21,8 @@ func TestTCPEcho(t *testing.T) { t.Skip() } + testenv.MustHaveGoRun(t) + // We're unable to use port 0 here (let the OS choose a spare port). // Although the WASM runtime accepts port 0, and the WASM module listens // successfully, there's no way for this test to query the selected port @@ -44,7 +47,7 @@ func TestTCPEcho(t *testing.T) { port++ } - subProcess := exec.Command("go", "run", "./testdata/tcpecho.go") + subProcess := exec.Command(testenv.GoToolPath(t), "run", "./testdata/tcpecho.go") subProcess.Env = append(os.Environ(), "GOOS=wasip1", "GOARCH=wasm") -- cgit v1.3