go.net/ipv6: disable tests on non-ipv6 kernels

R=dave, capnm9
CC=golang-dev
https://golang.org/cl/10051046
diff --git a/ipv6/icmp_test.go b/ipv6/icmp_test.go
index 9727829..a7833dd 100644
--- a/ipv6/icmp_test.go
+++ b/ipv6/icmp_test.go
@@ -52,6 +52,9 @@
 	case "plan9", "windows":
 		t.Skipf("not supported on %q", runtime.GOOS)
 	}
+	if !supportsIPv6 {
+		t.Skip("ipv6 is not supported")
+	}
 	if os.Getuid() != 0 {
 		t.Skip("must be root")
 	}
diff --git a/ipv6/multicast_test.go b/ipv6/multicast_test.go
index 395f8f5..8bd6055 100644
--- a/ipv6/multicast_test.go
+++ b/ipv6/multicast_test.go
@@ -19,6 +19,9 @@
 	case "plan9", "windows":
 		t.Skipf("not supported on %q", runtime.GOOS)
 	}
+	if !supportsIPv6 {
+		t.Skip("ipv6 is not supported")
+	}
 	ifi := loopbackInterface()
 	if ifi == nil {
 		t.Skipf("not available on %q", runtime.GOOS)
@@ -78,6 +81,9 @@
 	case "plan9", "windows":
 		t.Skipf("not supported on %q", runtime.GOOS)
 	}
+	if !supportsIPv6 {
+		t.Skip("ipv6 is not supported")
+	}
 	if os.Getuid() != 0 {
 		t.Skip("must be root")
 	}
diff --git a/ipv6/multicastlistener_test.go b/ipv6/multicastlistener_test.go
index 61cf357..836455f 100644
--- a/ipv6/multicastlistener_test.go
+++ b/ipv6/multicastlistener_test.go
@@ -24,6 +24,9 @@
 	case "plan9", "windows":
 		t.Skipf("not supported on %q", runtime.GOOS)
 	}
+	if !supportsIPv6 {
+		t.Skip("ipv6 is not supported")
+	}
 
 	for _, gaddr := range udpMultipleGroupListenerTests {
 		c, err := net.ListenPacket("udp6", "[::]:0") // wildcard address with non-reusable port
@@ -61,6 +64,9 @@
 	case "plan9", "windows":
 		t.Skipf("not supported on %q", runtime.GOOS)
 	}
+	if !supportsIPv6 {
+		t.Skip("ipv6 is not supported")
+	}
 
 	for _, gaddr := range udpMultipleGroupListenerTests {
 		c1, err := net.ListenPacket("udp6", "[ff02::]:1024") // wildcard address with reusable port
@@ -110,6 +116,9 @@
 	case "plan9", "windows":
 		t.Skipf("not supported on %q", runtime.GOOS)
 	}
+	if !supportsIPv6 {
+		t.Skip("ipv6 is not supported")
+	}
 
 	gaddr := &net.IPAddr{IP: net.ParseIP("ff02::114")} // see RFC 4727
 	type ml struct {
@@ -150,6 +159,9 @@
 	case "plan9", "windows":
 		t.Skipf("not supported on %q", runtime.GOOS)
 	}
+	if !supportsIPv6 {
+		t.Skip("ipv6 is not supported")
+	}
 	if os.Getuid() != 0 {
 		t.Skip("must be root")
 	}
diff --git a/ipv6/multicastsockopt_test.go b/ipv6/multicastsockopt_test.go
index 21fc32c..578c04a 100644
--- a/ipv6/multicastsockopt_test.go
+++ b/ipv6/multicastsockopt_test.go
@@ -25,6 +25,9 @@
 	case "plan9", "windows":
 		t.Skipf("not supported on %q", runtime.GOOS)
 	}
+	if !supportsIPv6 {
+		t.Skip("ipv6 is not supported")
+	}
 	ifi := loopbackInterface()
 	if ifi == nil {
 		t.Skipf("not available on %q", runtime.GOOS)
diff --git a/ipv6/sockopt_test.go b/ipv6/sockopt_test.go
index 95b5fad..e489ca8 100644
--- a/ipv6/sockopt_test.go
+++ b/ipv6/sockopt_test.go
@@ -12,6 +12,15 @@
 	"testing"
 )
 
+var supportsIPv6 bool
+
+func init() {
+	if ln, err := net.Listen("tcp6", "[::1]:0"); err == nil {
+		ln.Close()
+		supportsIPv6 = true
+	}
+}
+
 var condFatalf = func() func(*testing.T, string, ...interface{}) {
 	// A few APIs are not implemented yet on some platforms.
 	switch runtime.GOOS {
@@ -26,6 +35,9 @@
 	case "plan9", "windows":
 		t.Skipf("not supported on %q", runtime.GOOS)
 	}
+	if !supportsIPv6 {
+		t.Skip("ipv6 is not supported")
+	}
 
 	ln, err := net.Listen("tcp6", "[::1]:0")
 	if err != nil {
@@ -56,6 +68,9 @@
 	case "plan9", "windows":
 		t.Skipf("not supported on %q", runtime.GOOS)
 	}
+	if !supportsIPv6 {
+		t.Skip("ipv6 is not supported")
+	}
 
 	ln, err := net.Listen("tcp6", "[::1]:0")
 	if err != nil {
@@ -86,6 +101,9 @@
 	case "plan9", "windows":
 		t.Skipf("not supported on %q", runtime.GOOS)
 	}
+	if !supportsIPv6 {
+		t.Skip("ipv6 is not supported")
+	}
 	if os.Getuid() != 0 {
 		t.Skip("must be root")
 	}
diff --git a/ipv6/unicast_test.go b/ipv6/unicast_test.go
index 063dc4e..3393858 100644
--- a/ipv6/unicast_test.go
+++ b/ipv6/unicast_test.go
@@ -88,6 +88,9 @@
 	case "plan9", "windows":
 		t.Skipf("not supported on %q", runtime.GOOS)
 	}
+	if !supportsIPv6 {
+		t.Skip("ipv6 is not supported")
+	}
 
 	c, err := net.ListenPacket("udp6", "[::1]:0")
 	if err != nil {
@@ -132,6 +135,9 @@
 	case "plan9", "windows":
 		t.Skipf("not supported on %q", runtime.GOOS)
 	}
+	if !supportsIPv6 {
+		t.Skip("ipv6 is not supported")
+	}
 	if os.Getuid() != 0 {
 		t.Skip("must be root")
 	}
diff --git a/ipv6/unicastsockopt_test.go b/ipv6/unicastsockopt_test.go
index a2e5bc5..c4a79ea 100644
--- a/ipv6/unicastsockopt_test.go
+++ b/ipv6/unicastsockopt_test.go
@@ -17,6 +17,9 @@
 	case "plan9", "windows":
 		t.Skipf("not supported on %q", runtime.GOOS)
 	}
+	if !supportsIPv6 {
+		t.Skip("ipv6 is not supported")
+	}
 
 	ln, err := net.Listen("tcp6", "[::1]:0")
 	if err != nil {
@@ -50,6 +53,9 @@
 	case "plan9", "windows":
 		t.Skipf("not supported on %q", runtime.GOOS)
 	}
+	if !supportsIPv6 {
+		t.Skip("ipv6 is not supported")
+	}
 
 	for _, tt := range packetConnUnicastSocketOptionTests {
 		if tt.net == "ip6" && os.Getuid() != 0 {