go.net/ipv4: use testing.Skip{,f}

R=bradfitz, dave
CC=bradfitz, gobot, golang-dev, rsc
https://golang.org/cl/7194047
This commit is contained in:
Mikio Hara
2013-04-04 14:37:01 +09:00
parent d3158639e6
commit 413497eef8
5 changed files with 21 additions and 42 deletions

View File

@@ -15,8 +15,7 @@ import (
func TestReadWriteMulticastIPPayloadUDP(t *testing.T) {
if testing.Short() || !*testExternal {
t.Logf("skipping test to avoid external network")
return
t.Skip("to avoid external network")
}
c, err := net.ListenPacket("udp4", "224.0.0.0:1024") // see RFC 4727
@@ -27,8 +26,7 @@ func TestReadWriteMulticastIPPayloadUDP(t *testing.T) {
ifi := loopbackInterface()
if ifi == nil {
t.Logf("skipping test; an appropriate interface not found")
return
t.Skip("an appropriate interface not found")
}
dst, err := net.ResolveUDPAddr("udp4", "224.0.0.254:1024") // see RFC 4727
if err != nil {
@@ -56,12 +54,10 @@ func TestReadWriteMulticastIPPayloadUDP(t *testing.T) {
func TestReadWriteMulticastIPPayloadICMP(t *testing.T) {
if testing.Short() || !*testExternal {
t.Logf("skipping test to avoid external network")
return
t.Skip("to avoid external network")
}
if os.Getuid() != 0 {
t.Logf("skipping test; must be root")
return
t.Skip("must be root")
}
c, err := net.ListenPacket("ip4:icmp", "0.0.0.0")
@@ -72,8 +68,7 @@ func TestReadWriteMulticastIPPayloadICMP(t *testing.T) {
ifi := loopbackInterface()
if ifi == nil {
t.Logf("skipping test; an appropriate interface not found")
return
t.Skip("an appropriate interface not found")
}
dst, err := net.ResolveIPAddr("ip4", "224.0.0.254") // see RFC 4727
if err != nil {
@@ -115,12 +110,10 @@ func TestReadWriteMulticastIPPayloadICMP(t *testing.T) {
func TestReadWriteMulticastIPDatagram(t *testing.T) {
if testing.Short() || !*testExternal {
t.Logf("skipping test to avoid external network")
return
t.Skip("to avoid external network")
}
if os.Getuid() != 0 {
t.Logf("skipping test; must be root")
return
t.Skip("must be root")
}
c, err := net.ListenPacket("ip4:icmp", "0.0.0.0")
@@ -131,8 +124,7 @@ func TestReadWriteMulticastIPDatagram(t *testing.T) {
ifi := loopbackInterface()
if ifi == nil {
t.Logf("skipping test; an appropriate interface not found")
return
t.Skip("an appropriate interface not found")
}
dst, err := net.ResolveIPAddr("ip4", "224.0.0.254") // see RFC 4727
if err != nil {

View File

@@ -23,8 +23,7 @@ var udpMultipleGroupListenerTests = []struct {
func TestUDPSingleConnWithMultipleGroupListeners(t *testing.T) {
if testing.Short() || !*testExternal {
t.Logf("skipping test to avoid external network")
return
t.Skip("to avoid external network")
}
for _, tt := range udpMultipleGroupListenerTests {
@@ -61,8 +60,7 @@ func TestUDPSingleConnWithMultipleGroupListeners(t *testing.T) {
func TestUDPMultipleConnWithMultipleGroupListeners(t *testing.T) {
if testing.Short() || !*testExternal {
t.Logf("skipping test to avoid external network")
return
t.Skip("to avoid external network")
}
for _, tt := range udpMultipleGroupListenerTests {
@@ -112,12 +110,10 @@ func TestUDPMultipleConnWithMultipleGroupListeners(t *testing.T) {
func TestIPSingleConnWithSingleGroupListener(t *testing.T) {
if testing.Short() || !*testExternal {
t.Logf("skipping test to avoid external network")
return
t.Skip("to avoid external network")
}
if os.Getuid() != 0 {
t.Logf("skipping test; must be root")
return
t.Skip("must be root")
}
// listen to a wildcard address
@@ -156,8 +152,7 @@ func TestIPSingleConnWithSingleGroupListener(t *testing.T) {
func TestUDPPerInterfaceSingleConnWithSingleGroupListener(t *testing.T) {
if testing.Short() || !*testExternal {
t.Logf("skipping test to avoid external network")
return
t.Skip("to avoid external network")
}
gaddr := &net.IPAddr{IP: net.IPv4(224, 0, 0, 254)} // see RFC 4727
@@ -197,12 +192,10 @@ func TestUDPPerInterfaceSingleConnWithSingleGroupListener(t *testing.T) {
func TestIPPerInterfaceSingleConnWithSingleGroupListener(t *testing.T) {
if testing.Short() || !*testExternal {
t.Logf("skipping test to avoid external network")
return
t.Skip("to avoid external network")
}
if os.Getuid() != 0 {
t.Logf("skipping test; must be root")
return
t.Skip("must be root")
}
gaddr := &net.IPAddr{IP: net.IPv4(224, 0, 0, 254)} // see RFC 4727

View File

@@ -39,8 +39,7 @@ var multicastSockoptTests = []multicastSockoptTest{
func TestUDPMulticastSockopt(t *testing.T) {
if testing.Short() || !*testExternal {
t.Logf("skipping test to avoid external network")
return
t.Skip("to avoid external network")
}
for _, tt := range multicastSockoptTests {
@@ -57,12 +56,10 @@ func TestUDPMulticastSockopt(t *testing.T) {
func TestIPMulticastSockopt(t *testing.T) {
if testing.Short() || !*testExternal {
t.Logf("skipping test to avoid external network")
return
t.Skip("to avoid external network")
}
if os.Getuid() != 0 {
t.Logf("skipping test; must be root")
return
t.Skip("must be root")
}
for _, tt := range multicastSockoptTests {

View File

@@ -36,8 +36,7 @@ func TestReadWriteUnicastIPPayloadUDP(t *testing.T) {
func TestReadWriteUnicastIPPayloadICMP(t *testing.T) {
if os.Getuid() != 0 {
t.Logf("skipping test; must be root")
return
t.Skip("must be root")
}
c, err := net.ListenPacket("ip4:icmp", "0.0.0.0")
@@ -79,8 +78,7 @@ func TestReadWriteUnicastIPPayloadICMP(t *testing.T) {
func TestReadWriteUnicastIPDatagram(t *testing.T) {
if os.Getuid() != 0 {
t.Logf("skipping test; must be root")
return
t.Skip("must be root")
}
c, err := net.ListenPacket("ip4:icmp", "0.0.0.0")

View File

@@ -88,8 +88,7 @@ func TestUDPUnicastSockopt(t *testing.T) {
func TestIPUnicastSockopt(t *testing.T) {
if os.Getuid() != 0 {
t.Logf("skipping test; must be root")
return
t.Skip("must be root")
}
for _, tt := range unicastSockoptTests {