1
0
mirror of https://github.com/golang/go synced 2024-11-23 16:20:04 -07:00

internal/testenv: mark SkipFlaky and SkipFlakyNet as helpers

This makes the output they print refer to the code that called them.

For example, instead of

=== RUN   TestWindowsStackMemoryCgo
--- SKIP: TestWindowsStackMemoryCgo (0.00s)
        testenv.go:213: skipping known flaky test ...
PASS

we see

=== RUN   TestWindowsStackMemoryCgo
--- SKIP: TestWindowsStackMemoryCgo (0.00s)
        crash_cgo_test.go:471: skipping known flaky test ...
PASS

Change-Id: I5f4c77c3aeab5c0e43c6dde2f15db70a6df24603
Reviewed-on: https://go-review.googlesource.com/76031
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Alex Brainman 2017-11-04 12:35:23 +11:00
parent 8db19a4966
commit 0966045039

View File

@ -209,12 +209,14 @@ func MustHaveLink(t testing.TB) {
var flaky = flag.Bool("flaky", false, "run known-flaky tests too")
func SkipFlaky(t testing.TB, issue int) {
t.Helper()
if !*flaky {
t.Skipf("skipping known flaky test without the -flaky flag; see golang.org/issue/%d", issue)
}
}
func SkipFlakyNet(t testing.TB) {
t.Helper()
if v, _ := strconv.ParseBool(os.Getenv("GO_BUILDER_FLAKY_NET")); v {
t.Skip("skipping test on builder known to have frequent network failures")
}