]> Cypherpunks repositories - gostls13.git/commitdiff
net: move test flags into main_test.go
authorMikio Hara <mikioh.mikioh@gmail.com>
Thu, 2 Apr 2015 03:15:03 +0000 (12:15 +0900)
committerMikio Hara <mikioh.mikioh@gmail.com>
Thu, 2 Apr 2015 09:07:24 +0000 (09:07 +0000)
Also updates the comments on test flags.

Change-Id: I8dbd90270e08728ab309ab88a3030e0f8e547175
Reviewed-on: https://go-review.googlesource.com/8394
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/net/dial_test.go
src/net/dialgoogle_test.go
src/net/lookup_test.go
src/net/main_test.go
src/net/server_test.go

index 15ee71b9a0cc1563321ec62304f4e8dd37ca879a..39e61d5734bdfb73171cef35be53abfa7251ce6f 100644 (file)
@@ -6,7 +6,6 @@ package net
 
 import (
        "bytes"
-       "flag"
        "fmt"
        "io"
        "os"
@@ -77,8 +76,6 @@ func TestSelfConnect(t *testing.T) {
        }
 }
 
-var runErrorTest = flag.Bool("run_error_test", false, "let TestDialError check for dns errors")
-
 type DialErrorTest struct {
        Net     string
        Raddr   string
index df5895afa74f35cc20d6e4e85c25b73a18587a58..084de9f444c6b6387f04095fad0f26b51bbe2985 100644 (file)
@@ -5,7 +5,6 @@
 package net
 
 import (
-       "flag"
        "fmt"
        "io"
        "strings"
@@ -13,9 +12,6 @@ import (
        "testing"
 )
 
-// If an IPv6 tunnel is running, we can try dialing a real IPv6 address.
-var testIPv6 = flag.Bool("ipv6", false, "assume ipv6 tunnel is present")
-
 func TestResolveGoogle(t *testing.T) {
        if testing.Short() || !*testExternal {
                t.Skip("skipping test to avoid external network")
index 430adfd4763060547181fb748726bf41769ed9d7..658b32a885f77edb1db974c659d8c4a462a2b188 100644 (file)
@@ -8,15 +8,12 @@
 package net
 
 import (
-       "flag"
        "fmt"
        "strings"
        "testing"
        "time"
 )
 
-var testExternal = flag.Bool("external", true, "allow use of external networks during long test")
-
 var lookupGoogleSRVTests = []struct {
        service, proto, name string
        cname, target        string
@@ -232,8 +229,6 @@ func TestReverseAddress(t *testing.T) {
        }
 }
 
-var testDNSFlood = flag.Bool("dnsflood", false, "whether to test dns query flooding")
-
 func TestLookupIPDeadline(t *testing.T) {
        if !*testDNSFlood {
                t.Skip("test disabled; use -dnsflood to enable")
index 3ea27f179165e0f8349d8f55d13b5a5d5d777c86..2948c4ecd8fd5489b68ea5c320859e8abba182ed 100644 (file)
@@ -5,6 +5,7 @@
 package net
 
 import (
+       "flag"
        "fmt"
        "net/internal/socktest"
        "os"
@@ -22,6 +23,26 @@ var (
        testHookUninstaller sync.Once
 )
 
+var (
+       // Do not test datagrams with empty payload by default.
+       // It depends on each platform implementation whether generic
+       // read, socket recv system calls return the result of zero
+       // byte read.
+       testDatagram = flag.Bool("datagram", false, "whether to test UDP and unixgram")
+
+       testDNSFlood = flag.Bool("dnsflood", false, "whether to test DNS query flooding")
+
+       testExternal = flag.Bool("external", true, "allow use of external networks during long test")
+
+       // If external IPv6 connectivity exists, we can try dialing
+       // non-node/interface local scope IPv6 addresses.
+       testIPv6 = flag.Bool("ipv6", false, "assume external IPv6 connectivity exists")
+
+       // BUG: TestDialError has been broken, and so this flag
+       // exists. We should fix the test and remove this flag soon.
+       runErrorTest = flag.Bool("run_error_test", false, "let TestDialError check for DNS errors")
+)
+
 func TestMain(m *testing.M) {
        installTestHooks()
 
index 479c18124859be03b661b991738778f10f54b9dc..215d59d29fd6060797b6f41cdb4cf7aef99d5f7d 100644 (file)
@@ -5,7 +5,6 @@
 package net
 
 import (
-       "flag"
        "io"
        "os"
        "testing"
@@ -201,12 +200,6 @@ func runStreamConnClient(t *testing.T, net, taddr string, isEmpty bool) {
        }
 }
 
-// Do not test empty datagrams by default.
-// It causes unexplained timeouts on some systems,
-// including Snow Leopard.  I think that the kernel
-// doesn't quite expect them.
-var testDatagram = flag.Bool("datagram", false, "whether to test udp and unixgram")
-
 var datagramPacketConnServerTests = []struct {
        snet  string // server side
        saddr string