diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go index 5e57c0c427..9635c4fb61 100644 --- a/src/cmd/dist/test.go +++ b/src/cmd/dist/test.go @@ -71,7 +71,6 @@ type tester struct { short bool cgoEnabled bool - partial bool json bool tests []distTest // use addTest to extend @@ -235,11 +234,13 @@ func (t *tester) run() { } } + var anyIncluded, someExcluded bool for _, dt := range t.tests { if !t.shouldRunTest(dt.name) { - t.partial = true + someExcluded = true continue } + anyIncluded = true dt := dt // dt used in background after this iteration if err := dt.fn(&dt); err != nil { t.runPending(&dt) // in case that hasn't been done yet @@ -257,7 +258,11 @@ func (t *tester) run() { if !t.json { if t.failed { fmt.Println("\nFAILED") - } else if t.partial { + } else if !anyIncluded { + fmt.Println() + errprintf("go tool dist: warning: %q matched no tests; use the -list flag to list available tests\n", t.runRxStr) + fmt.Println("NO TESTS TO RUN") + } else if someExcluded { fmt.Println("\nALL TESTS PASSED (some were excluded)") } else { fmt.Println("\nALL TESTS PASSED")