From 1fc83690e68de1ce252975c5fd3a232629d6a3d6 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Fri, 16 Sep 2022 12:05:57 -0400 Subject: [PATCH] testing: allow go test -run=^$ testing This should fix the ssacheck builder. Change-Id: I4b6172df33d6447f7ec8fd8e301c6380efb92588 Reviewed-on: https://go-review.googlesource.com/c/go/+/431336 Auto-Submit: Russ Cox Run-TryBot: Russ Cox Reviewed-by: David Chase TryBot-Result: Gopher Robot --- src/testing/testing.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/testing/testing.go b/src/testing/testing.go index e3460e049d..81268ec61f 100644 --- a/src/testing/testing.go +++ b/src/testing/testing.go @@ -1766,12 +1766,13 @@ func (m *M) Run() (code int) { m.stopAlarm() if !testRan && !exampleRan && !fuzzTargetsRan && *matchBenchmarks == "" && *matchFuzz == "" { fmt.Fprintln(os.Stderr, "testing: warning: no tests to run") - if testingTesting { + if testingTesting && *match != "^$" { // If this happens during testing of package testing it could be that // package testing's own logic for when to run a test is broken, // in which case every test will run nothing and succeed, // with no obvious way to detect this problem (since no tests are running). // So make 'no tests to run' a hard failure when testing package testing itself. + // The compile-only builders use -run=^$ to run no tests, so allow that. fmt.Println("FAIL: package testing must run tests") testOk = false }