]> Cypherpunks repositories - gostls13.git/commitdiff
net: do not test TestReadWriteDeadline timeout upper bound during short test
authorAlex Brainman <alex.brainman@gmail.com>
Sun, 4 Nov 2012 01:41:49 +0000 (12:41 +1100)
committerAlex Brainman <alex.brainman@gmail.com>
Sun, 4 Nov 2012 01:41:49 +0000 (12:41 +1100)
It also increases timeout deltas to allow for longer wait.
Also disables this test on plan9.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/6821062

src/pkg/net/ipsock_plan9.go
src/pkg/net/timeout_test.go

index 7cc2d714d8aeee74cd855992dd1afbec2930cee4..f5be54cb2ac28f6a8c3d0975909bf1afff4f761a 100644 (file)
@@ -24,6 +24,8 @@ func probeIPv6Stack() (supportsIPv6, supportsIPv4map bool) {
        return false, false
 }
 
+var canCancelIO = true // used for testing current package
+
 // parsePlan9Addr parses address of the form [ip!]port (e.g. 127.0.0.1!80).
 func parsePlan9Addr(s string) (ip IP, iport int, err error) {
        addr := IPv4zero // address contains port only
index f6f92409df4bb2bc4dc356f19fa2d58870c68f61..d81cbb7c85d8b74f525594bf70a75e0349dc395f 100644 (file)
@@ -148,19 +148,24 @@ func TestTimeoutAccept(t *testing.T) {
 }
 
 func TestReadWriteDeadline(t *testing.T) {
+       switch runtime.GOOS {
+       case "plan9":
+               t.Logf("skipping test on %q", runtime.GOOS)
+               return
+       }
+
        if !canCancelIO {
                t.Logf("skipping test on this system")
                return
        }
        const (
-               readTimeout  = 100 * time.Millisecond
-               writeTimeout = 200 * time.Millisecond
-               delta        = 40 * time.Millisecond
+               readTimeout  = 50 * time.Millisecond
+               writeTimeout = 250 * time.Millisecond
        )
        checkTimeout := func(command string, start time.Time, should time.Duration) {
                is := time.Now().Sub(start)
                d := should - is
-               if d < -delta || delta < d {
+               if d < -30*time.Millisecond || !testing.Short() && 150*time.Millisecond < d {
                        t.Errorf("%s timeout test failed: is=%v should=%v\n", command, is, should)
                }
        }