From 45b0d82e15deb3b67a376c28f2140d223b1cc55f Mon Sep 17 00:00:00 2001 From: Mikio Hara Date: Tue, 15 Nov 2016 06:39:53 +0900 Subject: [PATCH] ipv6: document that package ipv6 doesn't support Darwin kernel version 12 or below This change also uses nettest.SupportsIPv6MulticastDeliveryOnLoopback to disable multicast packet delivery tests on some platform that doesn't support the feature. Fixes golang/go#17015. Change-Id: Ia547efc2ac3779a96592bbc3874533fb65b711af Reviewed-on: https://go-review.googlesource.com/33251 Run-TryBot: Mikio Hara TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor Reviewed-by: Brad Fitzpatrick --- ipv6/doc.go | 3 +++ ipv6/main_test.go | 27 --------------------------- ipv6/multicast_test.go | 12 ++++++------ 3 files changed, 9 insertions(+), 33 deletions(-) delete mode 100644 ipv6/main_test.go diff --git a/ipv6/doc.go b/ipv6/doc.go index 51c2334c..2151a493 100644 --- a/ipv6/doc.go +++ b/ipv6/doc.go @@ -16,6 +16,9 @@ // MLDv1 and MLDv2 are defined in RFC 2710 and RFC 3810. // Source-specific multicast is defined in RFC 4607. // +// On Darwin, this package requires OS X Mavericks version 10.9 or +// above, or equivalent. +// // // Unicasting // diff --git a/ipv6/main_test.go b/ipv6/main_test.go deleted file mode 100644 index 6ae53bb1..00000000 --- a/ipv6/main_test.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ipv6_test - -import ( - "flag" - "fmt" - "os" - "os/exec" - "runtime" - "strings" - "testing" -) - -func TestMain(m *testing.M) { - flag.Parse() - if runtime.GOOS == "darwin" { - vers, _ := exec.Command("sw_vers", "-productVersion").Output() - if string(vers) == "10.8" || strings.HasPrefix(string(vers), "10.8.") { - fmt.Fprintf(os.Stderr, "# skipping tests on OS X 10.8 to avoid kernel panics; golang.org/issue/17015\n") - os.Exit(0) - } - } - os.Exit(m.Run()) -} diff --git a/ipv6/multicast_test.go b/ipv6/multicast_test.go index 1647375d..69a21cd3 100644 --- a/ipv6/multicast_test.go +++ b/ipv6/multicast_test.go @@ -29,15 +29,15 @@ var packetConnReadWriteMulticastUDPTests = []struct { func TestPacketConnReadWriteMulticastUDP(t *testing.T) { switch runtime.GOOS { - case "freebsd": // due to a bug on loopback marking - // See http://www.freebsd.org/cgi/query-pr.cgi?pr=180065. - t.Skipf("not supported on %s", runtime.GOOS) case "nacl", "plan9", "windows": t.Skipf("not supported on %s", runtime.GOOS) } if !supportsIPv6 { t.Skip("ipv6 is not supported") } + if !nettest.SupportsIPv6MulticastDeliveryOnLoopback() { + t.Skipf("multicast delivery doesn't work correctly on %s", runtime.GOOS) + } ifi := nettest.RoutedInterface("ip6", net.FlagUp|net.FlagMulticast|net.FlagLoopback) if ifi == nil { t.Skipf("not available on %s", runtime.GOOS) @@ -129,15 +129,15 @@ var packetConnReadWriteMulticastICMPTests = []struct { func TestPacketConnReadWriteMulticastICMP(t *testing.T) { switch runtime.GOOS { - case "freebsd": // due to a bug on loopback marking - // See http://www.freebsd.org/cgi/query-pr.cgi?pr=180065. - t.Skipf("not supported on %s", runtime.GOOS) case "nacl", "plan9", "windows": t.Skipf("not supported on %s", runtime.GOOS) } if !supportsIPv6 { t.Skip("ipv6 is not supported") } + if !nettest.SupportsIPv6MulticastDeliveryOnLoopback() { + t.Skipf("multicast delivery doesn't work correctly on %s", runtime.GOOS) + } if m, ok := nettest.SupportsRawIPSocket(); !ok { t.Skip(m) }