1
0
mirror of https://github.com/golang/go synced 2024-09-30 16:28:32 -06:00

cmd/dist: only test packages and commands that have tests

Change-Id: I7aeb9fef3739c17c03fdaadbe00cd945ec9c0d72
Reviewed-on: https://go-review.googlesource.com/10492
Run-TryBot: Andrew Gerrand <adg@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Andrew Gerrand 2015-05-28 15:14:58 -07:00
parent ccc037699e
commit 4c050fea0e

View File

@ -395,7 +395,9 @@ func (t *tester) registerTests() {
// of running `go list std cmd` if we're running a specific test. // of running `go list std cmd` if we're running a specific test.
// Now we know the names of all the other tests registered so far. // Now we know the names of all the other tests registered so far.
if !t.wantSpecificRegisteredTest() { if !t.wantSpecificRegisteredTest() {
all, err := exec.Command("go", "list", "std", "cmd").Output() // Use a format string to only list packages and commands that have tests.
const format = "{{if (or .TestGoFiles .XTestGoFiles)}}{{.ImportPath}}{{end}}"
all, err := exec.Command("go", "list", "-f", format, "std", "cmd").Output()
if err != nil { if err != nil {
log.Fatalf("Error running go list std cmd: %v", err) log.Fatalf("Error running go list std cmd: %v", err)
} }