]> Cypherpunks repositories - gostls13.git/commitdiff
net, runtime: skip flaky tests on OpenBSD
authorBrad Fitzpatrick <bradfitz@golang.org>
Wed, 6 Apr 2016 19:02:27 +0000 (19:02 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Wed, 6 Apr 2016 19:28:24 +0000 (19:28 +0000)
Flaky tests are a distraction and cover up real problems.

File bugs instead and mark them as flaky.

This moves the net/http flaky test flagging mechanism to internal/testenv.

Updates #15156
Updates #15157
Updates #15158

Change-Id: I0e561cd2a09c0dec369cd4ed93bc5a2b40233dfe
Reviewed-on: https://go-review.googlesource.com/21614
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

src/context/context_test.go
src/go/build/deps_test.go
src/internal/testenv/testenv.go
src/net/dial_test.go
src/net/http/main_test.go
src/net/http/transport_test.go
src/net/timeout_test.go
src/net/unixsock_test.go
src/runtime/pprof/pprof_test.go

index 05345fc5e5fb856499057fef5d1b9ea59bdb69ef..60020303c7b73728e0e62eea998d0cca2fe1b3be 100644 (file)
@@ -6,6 +6,7 @@ package context
 
 import (
        "fmt"
+       "internal/testenv"
        "math/rand"
        "runtime"
        "strings"
@@ -258,6 +259,9 @@ func TestDeadline(t *testing.T) {
 }
 
 func TestTimeout(t *testing.T) {
+       if runtime.GOOS == "openbsd" {
+               testenv.SkipFlaky(t, 15158)
+       }
        c, _ := WithTimeout(Background(), 100*time.Millisecond)
        if got, prefix := fmt.Sprint(c), "context.Background.WithDeadline("; !strings.HasPrefix(got, prefix) {
                t.Errorf("c.String() = %q want prefix %q", got, prefix)
index c066048630c2eb50b09ccbda79d878cc74417a34..8e2fd6e5843687a1e4153829c40a61d879f87a3d 100644 (file)
@@ -168,7 +168,7 @@ var pkgDeps = map[string][]string{
        "testing":          {"L2", "flag", "fmt", "os", "runtime/debug", "runtime/pprof", "runtime/trace", "time"},
        "testing/iotest":   {"L2", "log"},
        "testing/quick":    {"L2", "flag", "fmt", "reflect"},
-       "internal/testenv": {"L2", "OS", "testing"},
+       "internal/testenv": {"L2", "OS", "flag", "testing"},
 
        // L4 is defined as L3+fmt+log+time, because in general once
        // you're using L3 packages, use of fmt, log, or time is not a big deal.
index e751e0cf11a1c2c257181e494ffc3f5da31898fd..9e684e3034388ebc002f970a24dadf2adaa34175 100644 (file)
@@ -11,6 +11,7 @@
 package testenv
 
 import (
+       "flag"
        "os"
        "os/exec"
        "path/filepath"
@@ -124,3 +125,11 @@ func MustHaveExternalNetwork(t *testing.T) {
                t.Skipf("skipping test: no external network in -short mode")
        }
 }
+
+var flaky = flag.Bool("flaky", false, "run known-flaky tests too")
+
+func SkipFlaky(t *testing.T, issue int) {
+       if !*flaky {
+               t.Skipf("skipping known flaky test without the -flaky flag; see golang.org/issue/%d", issue)
+       }
+}
index 2fc75c6356327b5181c31a6cf4ea9f521ed6c63c..f8e90abb4859fbb4d3f74ada323e79213372e21b 100644 (file)
@@ -59,6 +59,8 @@ func TestDialTimeoutFDLeak(t *testing.T) {
        switch runtime.GOOS {
        case "plan9":
                t.Skipf("%s does not have full support of socktest", runtime.GOOS)
+       case "openbsd":
+               testenv.SkipFlaky(t, 15157)
        }
 
        const T = 100 * time.Millisecond
@@ -126,6 +128,8 @@ func TestDialerDualStackFDLeak(t *testing.T) {
                t.Skipf("%s does not have full support of socktest", runtime.GOOS)
        case "windows":
                t.Skipf("not implemented a way to cancel dial racers in TCP SYN-SENT state on %s", runtime.GOOS)
+       case "openbsd":
+               testenv.SkipFlaky(t, 15157)
        }
        if !supportsIPv4 || !supportsIPv6 {
                t.Skip("both IPv4 and IPv6 are required")
index 299cd7b2d2f231c9b5ef75b964d23f595528d8fb..1163874ac2214756ecacbd7e2fdcec9609cd3eb6 100644 (file)
@@ -5,7 +5,6 @@
 package http_test
 
 import (
-       "flag"
        "fmt"
        "net/http"
        "os"
@@ -16,8 +15,6 @@ 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() {
@@ -91,12 +88,6 @@ func setParallel(t *testing.T) {
        }
 }
 
-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() {
index 7a01dca3941ebe780c831ec29cda5d1cd9e5f106..1aa26610b01ddd91087ab03bb7ae0dc5dbb64816 100644 (file)
@@ -18,6 +18,7 @@ import (
        "crypto/tls"
        "errors"
        "fmt"
+       "internal/testenv"
        "io"
        "io/ioutil"
        "log"
@@ -2229,7 +2230,7 @@ func TestTransportTLSHandshakeTimeout(t *testing.T) {
 // Trying to repro golang.org/issue/3514
 func TestTLSServerClosesConnection(t *testing.T) {
        defer afterTest(t)
-       setFlaky(t, 7634)
+       testenv.SkipFlaky(t, 7634)
 
        closedc := make(chan bool, 1)
        ts := httptest.NewTLSServer(HandlerFunc(func(w ResponseWriter, r *Request) {
index d80e478c7720ed7f80d0504ed41c26098f4f15d3..3ea0ec1ebd27821203b69ef0e7cbd446e2188323 100644 (file)
@@ -6,6 +6,7 @@ package net
 
 import (
        "fmt"
+       "internal/testenv"
        "io"
        "io/ioutil"
        "net/internal/socktest"
@@ -112,6 +113,9 @@ var dialTimeoutMaxDurationTests = []struct {
 
 func TestDialTimeoutMaxDuration(t *testing.T) {
        t.Parallel()
+       if runtime.GOOS == "openbsd" {
+               testenv.SkipFlaky(t, 15157)
+       }
 
        ln, err := newLocalListener("tcp")
        if err != nil {
index d70c0d19532d1a43052e4c7383462e2cf41d16b9..f0f88ed37b2bde307b5357ade6d4f7e5ec00b1a6 100644 (file)
@@ -8,6 +8,7 @@ package net
 
 import (
        "bytes"
+       "internal/testenv"
        "os"
        "reflect"
        "runtime"
@@ -20,6 +21,9 @@ func TestReadUnixgramWithUnnamedSocket(t *testing.T) {
        if !testableNetwork("unixgram") {
                t.Skip("unixgram test")
        }
+       if runtime.GOOS == "openbsd" {
+               testenv.SkipFlaky(t, 15157)
+       }
 
        addr := testUnixAddr()
        la, err := ResolveUnixAddr("unixgram", addr)
index fa0af59b37ab2f8e0c844f7ce6b9e2dbdebbc878..23bc72c1e4de492d78b07dd570d95480cd74217d 100644 (file)
@@ -585,6 +585,9 @@ func func3(c chan int) { <-c }
 func func4(c chan int) { <-c }
 
 func TestGoroutineCounts(t *testing.T) {
+       if runtime.GOOS == "openbsd" {
+               testenv.SkipFlaky(t, 15156)
+       }
        c := make(chan int)
        for i := 0; i < 100; i++ {
                if i%10 == 0 {