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>
This commit is contained in:
Mikio Hara
2015-01-28 12:07:22 +09:00
parent 8bc62b7ce1
commit 6fbfb1b1c0

View File

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