Browse Source

icmp: make use of nettest.SupportsRawIPSocket

Change-Id: I06585ba7e40c1653139520f3d67d96e5d86302ac
Reviewed-on: https://go-review.googlesource.com/3401
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Mikio Hara 11 years ago
parent
commit
6fbfb1b1c0
1 changed files with 4 additions and 1 deletions
  1. 4 1
      icmp/ping_test.go

+ 4 - 1
icmp/ping_test.go

@@ -13,6 +13,7 @@ import (
 
 
 	"golang.org/x/net/icmp"
 	"golang.org/x/net/icmp"
 	"golang.org/x/net/internal/iana"
 	"golang.org/x/net/internal/iana"
+	"golang.org/x/net/internal/nettest"
 	"golang.org/x/net/ipv4"
 	"golang.org/x/net/ipv4"
 	"golang.org/x/net/ipv6"
 	"golang.org/x/net/ipv6"
 )
 )
@@ -72,8 +73,10 @@ func TestPingGoogle(t *testing.T) {
 		t.Skipf("not supported on %q", runtime.GOOS)
 		t.Skipf("not supported on %q", runtime.GOOS)
 	}
 	}
 
 
+	m, ok := nettest.SupportsRawIPSocket()
 	for i, tt := range pingGoogleTests {
 	for i, tt := range pingGoogleTests {
-		if tt.network[:2] == "ip" && os.Getuid() != 0 {
+		if tt.network[:2] == "ip" && !ok {
+			t.Log(m)
 			continue
 			continue
 		}
 		}
 		c, err := icmp.ListenPacket(tt.network, tt.address)
 		c, err := icmp.ListenPacket(tt.network, tt.address)