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 <tobias.klauser@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Tobias Klauser 2022-09-28 19:19:44 +02:00 committed by Tobias Klauser
parent ae3abf16e4
commit dbf174d4b9
2 changed files with 2 additions and 21 deletions

View file

@ -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...)

19
src/cmd/dist/test.go vendored
View file

@ -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.