diff options
Diffstat (limited to 'libgo/go/net/http/main_test.go')
-rw-r--r-- | libgo/go/net/http/main_test.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libgo/go/net/http/main_test.go b/libgo/go/net/http/main_test.go index 12eea6f..299cd7b 100644 --- a/libgo/go/net/http/main_test.go +++ b/libgo/go/net/http/main_test.go @@ -5,6 +5,7 @@ package http_test import ( + "flag" "fmt" "net/http" "os" @@ -15,6 +16,8 @@ import ( "time" ) +var flaky = flag.Bool("flaky", false, "run known-flaky tests too") + func TestMain(m *testing.M) { v := m.Run() if v == 0 && goroutineLeaked() { @@ -79,6 +82,21 @@ func goroutineLeaked() bool { return true } +// setParallel marks t as a parallel test if we're in short mode +// (all.bash), but as a serial test otherwise. Using t.Parallel isn't +// compatible with the afterTest func in non-short mode. +func setParallel(t *testing.T) { + if testing.Short() { + t.Parallel() + } +} + +func setFlaky(t *testing.T, issue int) { + if !*flaky { + t.Skipf("skipping known flaky test; see golang.org/issue/%d", issue) + } +} + func afterTest(t testing.TB) { http.DefaultTransport.(*http.Transport).CloseIdleConnections() if testing.Short() { |