From dbf174d4b9dd96b225a1f10089478f8257a54f80 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Wed, 28 Sep 2022 19:19:44 +0200 Subject: [PATCH] cmd/dist: test cmd module on js/wasm Most tests will be skipped anyway because 'go build' is not available, but this ensures cmd will be build tested by TryBots for js/wasm. For #25911 For #35220 For #54219 Change-Id: I09c75905c36311810eb1ae75eeee2fa6102c1c0d Reviewed-on: https://go-review.googlesource.com/c/go/+/435237 Run-TryBot: Tobias Klauser Reviewed-by: Bryan Mills Reviewed-by: Dmitri Shuralyov TryBot-Result: Gopher Robot --- src/cmd/dist/build.go | 4 ---- src/cmd/dist/test.go | 19 ++----------------- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go index 5d60ba153e..4b2e545b2e 100644 --- a/src/cmd/dist/build.go +++ b/src/cmd/dist/build.go @@ -1427,10 +1427,6 @@ func cmdbootstrap() { xprintf("Building packages and commands for target, %s/%s.\n", goos, goarch) } targets := []string{"std", "cmd"} - if goos == "js" && goarch == "wasm" { - // Skip the cmd tools for js/wasm. They're not usable. - targets = targets[:1] - } goInstall(goBootstrap, targets...) checkNotStale(goBootstrap, targets...) checkNotStale(cmdGo, targets...) diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go index 181b61dd93..d27afb9fa1 100644 --- a/src/cmd/dist/test.go +++ b/src/cmd/dist/test.go @@ -162,11 +162,7 @@ func (t *tester) run() { // Instead, we can just check that it is not stale, which may be less // expensive (and is also more likely to catch bugs in the builder // implementation). - willTest := []string{"std"} - if t.shouldTestCmd() { - willTest = append(willTest, "cmd") - } - checkNotStale("go", willTest...) + checkNotStale("go", "std", "cmd") } } @@ -490,10 +486,7 @@ func (t *tester) registerTests() { if t.race { cmd.Args = append(cmd.Args, "-tags=race") } - cmd.Args = append(cmd.Args, "std") - if t.shouldTestCmd() { - cmd.Args = append(cmd.Args, "cmd") - } + cmd.Args = append(cmd.Args, "std", "cmd") cmd.Stderr = new(bytes.Buffer) all, err := cmd.Output() if err != nil { @@ -1682,14 +1675,6 @@ func (t *tester) shouldUsePrecompiledStdTest() bool { return err == nil } -func (t *tester) shouldTestCmd() bool { - if goos == "js" && goarch == "wasm" { - // Issues 25911, 35220 - return false - } - return true -} - // prebuiltGoPackageTestBinary returns the path where we'd expect // the pre-built go test binary to be on disk when dist test is run with // a single argument. -- 2.50.0