mirror of
https://github.com/golang/go
synced 2024-09-29 12:14:28 -06:00
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>
This commit is contained in:
parent
8a1ff51827
commit
d2ec964e9c
13
src/cmd/dist/test.go
vendored
13
src/cmd/dist/test.go
vendored
@ -601,9 +601,16 @@ func (t *tester) registerTests() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Use a format string to only list packages and commands that have tests.
|
// Use 'go list std cmd' to get a list of all Go packages
|
||||||
const format = "{{if (or .TestGoFiles .XTestGoFiles)}}{{.ImportPath}}{{end}}"
|
// that running 'go test std cmd' could find problems in.
|
||||||
cmd := exec.Command(gorootBinGo, "list", "-f", format)
|
// (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 {
|
if t.race {
|
||||||
cmd.Args = append(cmd.Args, "-tags=race")
|
cmd.Args = append(cmd.Args, "-tags=race")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user