From 7949ac6f083c2218d28178a32faf1e2b9c71c71e Mon Sep 17 00:00:00 2001 From: Mikio Hara Date: Wed, 13 Mar 2019 15:46:54 +0900 Subject: [PATCH] ipv4: skip tests on aix, fuchsia and hurd Also marks test helper functions. Change-Id: I3417885fb81c8ab27cdfbe80c83270b94b878862 Reviewed-on: https://go-review.googlesource.com/c/net/+/167339 Run-TryBot: Mikio Hara TryBot-Result: Gobot Gobot Reviewed-by: Matt Layher --- ipv4/multicast_test.go | 8 ++++++-- ipv4/multicastlistener_test.go | 10 +++++----- ipv4/multicastsockopt_test.go | 8 ++++++-- ipv4/readwrite_test.go | 13 ++++++++++--- ipv4/unicast_test.go | 6 +++--- ipv4/unicastsockopt_test.go | 8 +++++--- 6 files changed, 35 insertions(+), 18 deletions(-) diff --git a/ipv4/multicast_test.go b/ipv4/multicast_test.go index 2136a3c6..fd9efe00 100644 --- a/ipv4/multicast_test.go +++ b/ipv4/multicast_test.go @@ -29,7 +29,7 @@ var packetConnReadWriteMulticastUDPTests = []struct { func TestPacketConnReadWriteMulticastUDP(t *testing.T) { switch runtime.GOOS { - case "js", "nacl", "plan9", "solaris", "windows": + case "aix", "fuchsia", "hurd", "js", "nacl", "plan9", "solaris", "windows": t.Skipf("not supported on %s", runtime.GOOS) } ifi := nettest.RoutedInterface("ip4", net.FlagUp|net.FlagMulticast|net.FlagLoopback) @@ -117,7 +117,7 @@ var packetConnReadWriteMulticastICMPTests = []struct { func TestPacketConnReadWriteMulticastICMP(t *testing.T) { switch runtime.GOOS { - case "js", "nacl", "plan9", "solaris", "windows": + case "aix", "fuchsia", "hurd", "js", "nacl", "plan9", "solaris", "windows": t.Skipf("not supported on %s", runtime.GOOS) } if m, ok := nettest.SupportsRawIPSocket(); !ok { @@ -227,6 +227,10 @@ var rawConnReadWriteMulticastICMPTests = []struct { } func TestRawConnReadWriteMulticastICMP(t *testing.T) { + switch runtime.GOOS { + case "aix", "fuchsia", "hurd", "js", "nacl", "plan9", "solaris", "windows": + t.Skipf("not supported on %s", runtime.GOOS) + } if testing.Short() { t.Skip("to avoid external network") } diff --git a/ipv4/multicastlistener_test.go b/ipv4/multicastlistener_test.go index ba2480e4..73e509dd 100644 --- a/ipv4/multicastlistener_test.go +++ b/ipv4/multicastlistener_test.go @@ -21,7 +21,7 @@ var udpMultipleGroupListenerTests = []net.Addr{ func TestUDPSinglePacketConnWithMultipleGroupListeners(t *testing.T) { switch runtime.GOOS { - case "js", "nacl", "plan9", "windows": + case "aix", "fuchsia", "hurd", "js", "nacl", "plan9", "windows": t.Skipf("not supported on %s", runtime.GOOS) } if testing.Short() { @@ -61,7 +61,7 @@ func TestUDPSinglePacketConnWithMultipleGroupListeners(t *testing.T) { func TestUDPMultiplePacketConnWithMultipleGroupListeners(t *testing.T) { switch runtime.GOOS { - case "js", "nacl", "plan9", "windows": + case "aix", "fuchsia", "hurd", "js", "nacl", "plan9", "windows": t.Skipf("not supported on %s", runtime.GOOS) } if testing.Short() { @@ -116,7 +116,7 @@ func TestUDPMultiplePacketConnWithMultipleGroupListeners(t *testing.T) { func TestUDPPerInterfaceSinglePacketConnWithSingleGroupListener(t *testing.T) { switch runtime.GOOS { - case "js", "nacl", "plan9", "windows": + case "aix", "fuchsia", "hurd", "js", "nacl", "plan9", "windows": t.Skipf("not supported on %s", runtime.GOOS) } if testing.Short() { @@ -172,7 +172,7 @@ func TestUDPPerInterfaceSinglePacketConnWithSingleGroupListener(t *testing.T) { func TestIPSingleRawConnWithSingleGroupListener(t *testing.T) { switch runtime.GOOS { - case "js", "nacl", "plan9", "windows": + case "aix", "fuchsia", "hurd", "js", "nacl", "plan9", "windows": t.Skipf("not supported on %s", runtime.GOOS) } if testing.Short() { @@ -217,7 +217,7 @@ func TestIPSingleRawConnWithSingleGroupListener(t *testing.T) { func TestIPPerInterfaceSingleRawConnWithSingleGroupListener(t *testing.T) { switch runtime.GOOS { - case "js", "nacl", "plan9", "windows": + case "aix", "fuchsia", "hurd", "js", "nacl", "plan9", "windows": t.Skipf("not supported on %s", runtime.GOOS) } if testing.Short() { diff --git a/ipv4/multicastsockopt_test.go b/ipv4/multicastsockopt_test.go index c0a26800..fd783d05 100644 --- a/ipv4/multicastsockopt_test.go +++ b/ipv4/multicastsockopt_test.go @@ -26,7 +26,7 @@ var packetConnMulticastSocketOptionTests = []struct { func TestPacketConnMulticastSocketOptions(t *testing.T) { switch runtime.GOOS { - case "js", "nacl", "plan9": + case "aix", "fuchsia", "hurd", "js", "nacl", "plan9": t.Skipf("not supported on %s", runtime.GOOS) } ifi := nettest.RoutedInterface("ip4", net.FlagUp|net.FlagMulticast|net.FlagLoopback) @@ -66,7 +66,7 @@ var rawConnMulticastSocketOptionTests = []struct { func TestRawConnMulticastSocketOptions(t *testing.T) { switch runtime.GOOS { - case "js", "nacl", "plan9": + case "aix", "fuchsia", "hurd", "js", "nacl", "plan9": t.Skipf("not supported on %s", runtime.GOOS) } if m, ok := nettest.SupportsRawIPSocket(); !ok { @@ -111,6 +111,8 @@ type testIPv4MulticastConn interface { } func testMulticastSocketOptions(t *testing.T, c testIPv4MulticastConn, ifi *net.Interface, grp net.Addr) { + t.Helper() + const ttl = 255 if err := c.SetMulticastTTL(ttl); err != nil { t.Error(err) @@ -149,6 +151,8 @@ func testMulticastSocketOptions(t *testing.T, c testIPv4MulticastConn, ifi *net. } func testSourceSpecificMulticastSocketOptions(t *testing.T, c testIPv4MulticastConn, ifi *net.Interface, grp, src net.Addr) { + t.Helper() + // MCAST_JOIN_GROUP -> MCAST_BLOCK_SOURCE -> MCAST_UNBLOCK_SOURCE -> MCAST_LEAVE_GROUP if err := c.JoinGroup(ifi, grp); err != nil { t.Error(err) diff --git a/ipv4/readwrite_test.go b/ipv4/readwrite_test.go index d6e35be9..acf87d1e 100644 --- a/ipv4/readwrite_test.go +++ b/ipv4/readwrite_test.go @@ -19,6 +19,11 @@ import ( ) func BenchmarkReadWriteUnicast(b *testing.B) { + switch runtime.GOOS { + case "aix", "fuchsia", "hurd", "js", "nacl", "plan9", "windows": + b.Skipf("not supported on %s", runtime.GOOS) + } + c, err := nettest.NewLocalPacketListener("udp4") if err != nil { b.Skipf("not supported on %s/%s: %v", runtime.GOOS, runtime.GOARCH, err) @@ -63,7 +68,7 @@ func BenchmarkReadWriteUnicast(b *testing.B) { func BenchmarkPacketConnReadWriteUnicast(b *testing.B) { switch runtime.GOOS { - case "js", "nacl", "plan9", "windows": + case "aix", "fuchsia", "hurd", "js", "nacl", "plan9", "windows": b.Skipf("not supported on %s", runtime.GOOS) } @@ -213,7 +218,7 @@ func BenchmarkPacketConnReadWriteUnicast(b *testing.B) { func TestPacketConnConcurrentReadWriteUnicastUDP(t *testing.T) { switch runtime.GOOS { - case "js", "nacl", "plan9", "windows": + case "aix", "fuchsia", "hurd", "js", "nacl", "plan9", "windows": t.Skipf("not supported on %s", runtime.GOOS) } @@ -293,7 +298,7 @@ func TestPacketConnConcurrentReadWriteUnicastUDP(t *testing.T) { func TestPacketConnConcurrentReadWriteUnicast(t *testing.T) { switch runtime.GOOS { - case "js", "nacl", "plan9", "windows": + case "aix", "fuchsia", "hurd", "js", "nacl", "plan9", "windows": t.Skipf("not supported on %s", runtime.GOOS) } @@ -351,6 +356,8 @@ func TestPacketConnConcurrentReadWriteUnicast(t *testing.T) { } func testPacketConnConcurrentReadWriteUnicast(t *testing.T, p *ipv4.PacketConn, data []byte, dst net.Addr, batch bool) { + t.Helper() + ifi := nettest.RoutedInterface("ip4", net.FlagUp|net.FlagLoopback) cf := ipv4.FlagTTL | ipv4.FlagSrc | ipv4.FlagDst | ipv4.FlagInterface diff --git a/ipv4/unicast_test.go b/ipv4/unicast_test.go index 274a558c..a75f54ea 100644 --- a/ipv4/unicast_test.go +++ b/ipv4/unicast_test.go @@ -20,7 +20,7 @@ import ( func TestPacketConnReadWriteUnicastUDP(t *testing.T) { switch runtime.GOOS { - case "js", "nacl", "plan9", "windows": + case "aix", "fuchsia", "hurd", "js", "nacl", "plan9", "windows": t.Skipf("not supported on %s", runtime.GOOS) } ifi := nettest.RoutedInterface("ip4", net.FlagUp|net.FlagLoopback) @@ -71,7 +71,7 @@ func TestPacketConnReadWriteUnicastUDP(t *testing.T) { func TestPacketConnReadWriteUnicastICMP(t *testing.T) { switch runtime.GOOS { - case "js", "nacl", "plan9", "windows": + case "aix", "fuchsia", "hurd", "js", "nacl", "plan9", "windows": t.Skipf("not supported on %s", runtime.GOOS) } if m, ok := nettest.SupportsRawIPSocket(); !ok { @@ -157,7 +157,7 @@ func TestPacketConnReadWriteUnicastICMP(t *testing.T) { func TestRawConnReadWriteUnicastICMP(t *testing.T) { switch runtime.GOOS { - case "js", "nacl", "plan9", "windows": + case "aix", "fuchsia", "hurd", "js", "nacl", "plan9", "windows": t.Skipf("not supported on %s", runtime.GOOS) } if m, ok := nettest.SupportsRawIPSocket(); !ok { diff --git a/ipv4/unicastsockopt_test.go b/ipv4/unicastsockopt_test.go index 2bfda7ff..9a279b7d 100644 --- a/ipv4/unicastsockopt_test.go +++ b/ipv4/unicastsockopt_test.go @@ -16,7 +16,7 @@ import ( func TestConnUnicastSocketOptions(t *testing.T) { switch runtime.GOOS { - case "js", "nacl", "plan9", "windows": + case "aix", "fuchsia", "hurd", "js", "nacl", "plan9", "windows": t.Skipf("not supported on %s", runtime.GOOS) } ifi := nettest.RoutedInterface("ip4", net.FlagUp|net.FlagLoopback) @@ -62,7 +62,7 @@ var packetConnUnicastSocketOptionTests = []struct { func TestPacketConnUnicastSocketOptions(t *testing.T) { switch runtime.GOOS { - case "js", "nacl", "plan9", "windows": + case "aix", "fuchsia", "hurd", "js", "nacl", "plan9", "windows": t.Skipf("not supported on %s", runtime.GOOS) } ifi := nettest.RoutedInterface("ip4", net.FlagUp|net.FlagLoopback) @@ -88,7 +88,7 @@ func TestPacketConnUnicastSocketOptions(t *testing.T) { func TestRawConnUnicastSocketOptions(t *testing.T) { switch runtime.GOOS { - case "js", "nacl", "plan9", "windows": + case "aix", "fuchsia", "hurd", "js", "nacl", "plan9", "windows": t.Skipf("not supported on %s", runtime.GOOS) } if m, ok := nettest.SupportsRawIPSocket(); !ok { @@ -121,6 +121,8 @@ type testIPv4UnicastConn interface { } func testUnicastSocketOptions(t *testing.T, c testIPv4UnicastConn) { + t.Helper() + tos := iana.DiffServCS0 | iana.NotECNTransport switch runtime.GOOS { case "windows":