summaryrefslogtreecommitdiffhomepage
path: root/cmd/testwrapper/flakytest/flakytest.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/testwrapper/flakytest/flakytest.go')
-rw-r--r--cmd/testwrapper/flakytest/flakytest.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/cmd/testwrapper/flakytest/flakytest.go b/cmd/testwrapper/flakytest/flakytest.go
index 494ed080b..b983da685 100644
--- a/cmd/testwrapper/flakytest/flakytest.go
+++ b/cmd/testwrapper/flakytest/flakytest.go
@@ -7,9 +7,9 @@
package flakytest
import (
- "fmt"
"os"
"regexp"
+ "strings"
"testing"
)
@@ -38,7 +38,14 @@ func Mark(t testing.TB, issue string) {
// We're being run under cmd/testwrapper so send our sentinel message
// to stderr. (We avoid doing this when the env is absent to avoid
// spamming people running tests without the wrapper)
- fmt.Fprintf(os.Stderr, "%s: %s\n", FlakyTestLogMessage, issue)
+ t.Cleanup(func() {
+ if t.Failed() {
+ // FIXME: this won't catch panics because t.Failed() won't yet
+ // be correctly set. https://github.com/golang/go/issues/49929
+ root, _, _ := strings.Cut(t.Name(), "/")
+ t.Logf("flakytest: retry: %s %s", root, strings.Join(os.Args, " "))
+ }
+ })
}
t.Logf("flakytest: issue tracking this flaky test: %s", issue)
}