Commit 52c84c34 authored by Mikio Hara's avatar Mikio Hara

net: move test flags into main_test.go

Also updates the comments on test flags.

Change-Id: I8dbd90270e08728ab309ab88a3030e0f8e547175
Reviewed-on: https://go-review.googlesource.com/8394Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent bd09279c
...@@ -6,7 +6,6 @@ package net ...@@ -6,7 +6,6 @@ package net
import ( import (
"bytes" "bytes"
"flag"
"fmt" "fmt"
"io" "io"
"os" "os"
...@@ -77,8 +76,6 @@ func TestSelfConnect(t *testing.T) { ...@@ -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 { type DialErrorTest struct {
Net string Net string
Raddr string Raddr string
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
package net package net
import ( import (
"flag"
"fmt" "fmt"
"io" "io"
"strings" "strings"
...@@ -13,9 +12,6 @@ import ( ...@@ -13,9 +12,6 @@ import (
"testing" "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) { func TestResolveGoogle(t *testing.T) {
if testing.Short() || !*testExternal { if testing.Short() || !*testExternal {
t.Skip("skipping test to avoid external network") t.Skip("skipping test to avoid external network")
......
...@@ -8,15 +8,12 @@ ...@@ -8,15 +8,12 @@
package net package net
import ( import (
"flag"
"fmt" "fmt"
"strings" "strings"
"testing" "testing"
"time" "time"
) )
var testExternal = flag.Bool("external", true, "allow use of external networks during long test")
var lookupGoogleSRVTests = []struct { var lookupGoogleSRVTests = []struct {
service, proto, name string service, proto, name string
cname, target string cname, target string
...@@ -232,8 +229,6 @@ func TestReverseAddress(t *testing.T) { ...@@ -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) { func TestLookupIPDeadline(t *testing.T) {
if !*testDNSFlood { if !*testDNSFlood {
t.Skip("test disabled; use -dnsflood to enable") t.Skip("test disabled; use -dnsflood to enable")
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
package net package net
import ( import (
"flag"
"fmt" "fmt"
"net/internal/socktest" "net/internal/socktest"
"os" "os"
...@@ -22,6 +23,26 @@ var ( ...@@ -22,6 +23,26 @@ var (
testHookUninstaller sync.Once 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) { func TestMain(m *testing.M) {
installTestHooks() installTestHooks()
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
package net package net
import ( import (
"flag"
"io" "io"
"os" "os"
"testing" "testing"
...@@ -201,12 +200,6 @@ func runStreamConnClient(t *testing.T, net, taddr string, isEmpty bool) { ...@@ -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 { var datagramPacketConnServerTests = []struct {
snet string // server side snet string // server side
saddr string saddr string
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment