diff options
| author | Russ Cox <rsc@golang.org> | 2025-11-05 14:05:45 -0500 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2025-11-05 12:30:28 -0800 |
| commit | a8fb94969cb98efd84fa4f6fdccc14a5866828be (patch) | |
| tree | e7ca92c25fea209d0397d608d2508841681c9621 /src/cmd | |
| parent | 04f05219c4f78b0f932485d2544b8c7193c04bb0 (diff) | |
| download | go-a8fb94969cb98efd84fa4f6fdccc14a5866828be.tar.xz | |
cmd/go: fix TestScript/tool_build_as_needed
This test assumes that changing GOOS/GOARCH results in an
unrunnable binary, but that's not true if the user has
go_GOOS_GOARCH_exec programs in their path (like I do).
This test was timing out waiting to create a gomote to run
a windows/amd64 binary.
Rewrite the test not to assume that alternate GOOS/GOARCH
binaries are unrunnable.
Fixes one failing case in 'go test cmd/go' on my Mac.
Change-Id: Ib5f721f91e10d285820efb5995a3a9bc29833214
Reviewed-on: https://go-review.googlesource.com/c/go/+/718180
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/cmd')
| -rw-r--r-- | src/cmd/go/testdata/script/tool_build_as_needed.txt | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/cmd/go/testdata/script/tool_build_as_needed.txt b/src/cmd/go/testdata/script/tool_build_as_needed.txt index 8868ed3085..e9bb8d34f3 100644 --- a/src/cmd/go/testdata/script/tool_build_as_needed.txt +++ b/src/cmd/go/testdata/script/tool_build_as_needed.txt @@ -40,13 +40,15 @@ rm $TOOLDIR/test2json$GOEXE go tool -n test2json ! stdout $NEWTOOLDIR${/}test2json$GOEXE # Set GOOS/GOARCH to different values than host GOOS/GOARCH. -env GOOS=windows -[GOOS:windows] env GOOS=linux -env GOARCH=arm64 -[GOARCH:arm64] env GOARCH=amd64 +env GOOS=js +env GOARCH=wasm # Control case: go run shouldn't work because it respects # GOOS/GOARCH, and we can't execute non-native binary. -! go run cmd/test2json -exec='' -# But go tool should because it doesn't respect GOOS/GOARCH. +# Don't actually run the binary because maybe we can. +# (Maybe the user has a go_js_wasm_exec installed.) +# Instead just look to see that the right binary got linked. +go run -n cmd/test2json +stderr modinfo.*GOARCH=wasm.*GOOS=js +# go tool should succeed because it doesn't respect GOOS/GOARCH. go tool test2json stdout '{"Action":"start"}' |
