aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/dist/test.go
diff options
context:
space:
mode:
authorDmitri Shuralyov <dmitshur@golang.org>2023-06-13 16:04:06 -0400
committerGopher Robot <gobot@golang.org>2023-07-27 17:32:18 +0000
commitd2ec964e9c1ec84aa2e4444783ed68018ae4d5e4 (patch)
tree341e1a01579a15b984c859a4622e002e9825943e /src/cmd/dist/test.go
parent8a1ff5182780af72d08c3e6b91694425a1498014 (diff)
downloadgo-d2ec964e9c1ec84aa2e4444783ed68018ae4d5e4.tar.gz
go-d2ec964e9c1ec84aa2e4444783ed68018ae4d5e4.zip
cmd/dist: test all 'std cmd' packages, even ones without _test.go files
Remove the optimization added in CL 10492 that skips running 'go test' on Go packages without _test.go files. By now, 'go test' can find real problems even in packages that don't have any custom tests. On my fairly fast laptop, running go test -short on all 164 normal and 96 vendored packages without tests took around 10 seconds on the first run and 2.5 seconds on the second, a small fraction of the total all.bash time. So prioritize gains in the test coverage over those savings in all.bash time. Fixes golang/go#60463. Change-Id: I3d2bec5c367de687e57131e7fd7e6b84fed30187 Reviewed-on: https://go-review.googlesource.com/c/go/+/503095 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Austin Clements <austin@google.com>
Diffstat (limited to 'src/cmd/dist/test.go')
-rw-r--r--src/cmd/dist/test.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go
index 554adea1b1..5a875ebf19 100644
--- a/src/cmd/dist/test.go
+++ b/src/cmd/dist/test.go
@@ -601,9 +601,16 @@ func (t *tester) registerTests() {
}
}
} else {
- // Use a format string to only list packages and commands that have tests.
- const format = "{{if (or .TestGoFiles .XTestGoFiles)}}{{.ImportPath}}{{end}}"
- cmd := exec.Command(gorootBinGo, "list", "-f", format)
+ // Use 'go list std cmd' to get a list of all Go packages
+ // that running 'go test std cmd' could find problems in.
+ // (In race test mode, also set -tags=race.)
+ //
+ // This includes vendored packages and other packages without
+ // tests so that 'dist test' finds if any of them don't build,
+ // have a problem reported by high-confidence vet checks that
+ // come with 'go test', and anything else 'go test' may check
+ // in the future. See go.dev/issue/60463.
+ cmd := exec.Command(gorootBinGo, "list")
if t.race {
cmd.Args = append(cmd.Args, "-tags=race")
}