Commit 0f9b3059 authored by Mikio Hara's avatar Mikio Hara

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
parent 68130a07
...@@ -93,7 +93,7 @@ var ipv6MulticastListenerTests = []struct { ...@@ -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 {
......
...@@ -45,7 +45,7 @@ var listenerTests = []struct { ...@@ -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)
} }
...@@ -68,66 +68,9 @@ func TestTCPListener(t *testing.T) { ...@@ -68,66 +68,9 @@ func TestTCPListener(t *testing.T) {
// listener with same address family, same listening address and // listener with same address family, same listening address and
// same port. // same port.
func TestUDPListener(t *testing.T) { func TestUDPListener(t *testing.T) {
switch runtime.GOOS {
case "plan9", "windows":
t.Skipf("skipping test on %q", runtime.GOOS)
}
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 && !supportsIPv6 {
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()
}
}
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 { switch runtime.GOOS {
case "plan9": case "plan9":
t.Skipf("skipping test on %q", runtime.GOOS) t.Skipf("skipping test on %q", runtime.GOOS)
return
} }
toudpnet := func(net string) string { toudpnet := func(net string) string {
...@@ -146,7 +89,7 @@ func TestSimpleUDPListener(t *testing.T) { ...@@ -146,7 +89,7 @@ func TestSimpleUDPListener(t *testing.T) {
if tt.wildcard && (testing.Short() || !*testExternal) { if tt.wildcard && (testing.Short() || !*testExternal) {
continue continue
} }
if tt.ipv6 { if tt.ipv6 && !supportsIPv6 {
continue continue
} }
tt.net = toudpnet(tt.net) tt.net = toudpnet(tt.net)
...@@ -231,7 +174,7 @@ func TestDualStackTCPListener(t *testing.T) { ...@@ -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) { ...@@ -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 {
......
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