1
0
mirror of https://github.com/golang/go synced 2024-11-26 05:17:58 -07:00

net: enable IPv6 tests on Windows

Also removes redundant tests that run Go 1.0 non-IPv6 support
Windows code on IPv6 enabled Windows kernels.

R=alex.brainman, golang-dev, bradfitz, dave
CC=golang-dev
https://golang.org/cl/7812052
This commit is contained in:
Mikio Hara 2013-03-29 11:46:47 +09:00
parent 68130a07af
commit 0f9b3059bc
2 changed files with 5 additions and 62 deletions

View File

@ -93,7 +93,7 @@ var ipv6MulticastListenerTests = []struct {
// port. // port.
func TestIPv6MulticastListener(t *testing.T) { func TestIPv6MulticastListener(t *testing.T) {
switch runtime.GOOS { switch runtime.GOOS {
case "plan9", "solaris", "windows": case "plan9", "solaris":
t.Skipf("skipping test on %q", runtime.GOOS) t.Skipf("skipping test on %q", runtime.GOOS)
} }
if !supportsIPv6 { if !supportsIPv6 {

View File

@ -45,7 +45,7 @@ var listenerTests = []struct {
// same port. // same port.
func TestTCPListener(t *testing.T) { func TestTCPListener(t *testing.T) {
switch runtime.GOOS { switch runtime.GOOS {
case "plan9", "windows": case "plan9":
t.Skipf("skipping test on %q", runtime.GOOS) t.Skipf("skipping test on %q", runtime.GOOS)
} }
@ -69,7 +69,7 @@ func TestTCPListener(t *testing.T) {
// same port. // same port.
func TestUDPListener(t *testing.T) { func TestUDPListener(t *testing.T) {
switch runtime.GOOS { switch runtime.GOOS {
case "plan9", "windows": case "plan9":
t.Skipf("skipping test on %q", runtime.GOOS) t.Skipf("skipping test on %q", runtime.GOOS)
} }
@ -101,63 +101,6 @@ func TestUDPListener(t *testing.T) {
} }
} }
func TestSimpleTCPListener(t *testing.T) {
switch runtime.GOOS {
case "plan9":
t.Skipf("skipping test on %q", runtime.GOOS)
return
}
for _, tt := range listenerTests {
if tt.wildcard && (testing.Short() || !*testExternal) {
continue
}
if tt.ipv6 {
continue
}
l1, port := usableListenPort(t, tt.net, tt.laddr)
checkFirstListener(t, tt.net, tt.laddr+":"+port, l1)
l2, err := Listen(tt.net, tt.laddr+":"+port)
checkSecondListener(t, tt.net, tt.laddr+":"+port, err, l2)
l1.Close()
}
}
func TestSimpleUDPListener(t *testing.T) {
switch runtime.GOOS {
case "plan9":
t.Skipf("skipping test on %q", runtime.GOOS)
return
}
toudpnet := func(net string) string {
switch net {
case "tcp":
return "udp"
case "tcp4":
return "udp4"
case "tcp6":
return "udp6"
}
return "<nil>"
}
for _, tt := range listenerTests {
if tt.wildcard && (testing.Short() || !*testExternal) {
continue
}
if tt.ipv6 {
continue
}
tt.net = toudpnet(tt.net)
l1, port := usableListenPacketPort(t, tt.net, tt.laddr)
checkFirstListener(t, tt.net, tt.laddr+":"+port, l1)
l2, err := ListenPacket(tt.net, tt.laddr+":"+port)
checkSecondListener(t, tt.net, tt.laddr+":"+port, err, l2)
l1.Close()
}
}
var dualStackListenerTests = []struct { var dualStackListenerTests = []struct {
net1 string // first listener net1 string // first listener
laddr1 string laddr1 string
@ -231,7 +174,7 @@ func TestDualStackTCPListener(t *testing.T) {
t.Skipf("skipping test on %q", runtime.GOOS) t.Skipf("skipping test on %q", runtime.GOOS)
} }
if !supportsIPv6 { if !supportsIPv6 {
return t.Skip("ipv6 is not supported")
} }
for _, tt := range dualStackListenerTests { for _, tt := range dualStackListenerTests {
@ -263,7 +206,7 @@ func TestDualStackUDPListener(t *testing.T) {
t.Skipf("skipping test on %q", runtime.GOOS) t.Skipf("skipping test on %q", runtime.GOOS)
} }
if !supportsIPv6 { if !supportsIPv6 {
return t.Skip("ipv6 is not supported")
} }
toudpnet := func(net string) string { toudpnet := func(net string) string {