Commit 586296a6 authored by Mikio Hara's avatar Mikio Hara

x/net/ipv6: skip ancillary data socket option tests on non-supported kernels

For old darwin kernels.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/166410043
parent 3064e1c1
...@@ -77,6 +77,9 @@ func TestPacketConnReadWriteMulticastUDP(t *testing.T) { ...@@ -77,6 +77,9 @@ func TestPacketConnReadWriteMulticastUDP(t *testing.T) {
for i, toggle := range []bool{true, false, true} { for i, toggle := range []bool{true, false, true} {
if err := p.SetControlMessage(cf, toggle); err != nil { if err := p.SetControlMessage(cf, toggle); err != nil {
if nettest.ProtocolNotSupported(err) {
t.Skipf("not supported on %q", runtime.GOOS)
}
t.Fatalf("ipv6.PacketConn.SetControlMessage failed: %v", err) t.Fatalf("ipv6.PacketConn.SetControlMessage failed: %v", err)
} }
if err := p.SetDeadline(time.Now().Add(200 * time.Millisecond)); err != nil { if err := p.SetDeadline(time.Now().Add(200 * time.Millisecond)); err != nil {
...@@ -183,6 +186,9 @@ func TestPacketConnReadWriteMulticastICMP(t *testing.T) { ...@@ -183,6 +186,9 @@ func TestPacketConnReadWriteMulticastICMP(t *testing.T) {
t.Fatalf("icmp.Message.Marshal failed: %v", err) t.Fatalf("icmp.Message.Marshal failed: %v", err)
} }
if err := p.SetControlMessage(cf, toggle); err != nil { if err := p.SetControlMessage(cf, toggle); err != nil {
if nettest.ProtocolNotSupported(err) {
t.Skipf("not supported on %q", runtime.GOOS)
}
t.Fatalf("ipv6.PacketConn.SetControlMessage failed: %v", err) t.Fatalf("ipv6.PacketConn.SetControlMessage failed: %v", err)
} }
if err := p.SetDeadline(time.Now().Add(200 * time.Millisecond)); err != nil { if err := p.SetDeadline(time.Now().Add(200 * time.Millisecond)); err != nil {
......
...@@ -60,7 +60,7 @@ func BenchmarkReadWriteIPv6UDP(b *testing.B) { ...@@ -60,7 +60,7 @@ func BenchmarkReadWriteIPv6UDP(b *testing.B) {
defer c.Close() defer c.Close()
p := ipv6.NewPacketConn(c) p := ipv6.NewPacketConn(c)
cf := ipv6.FlagTrafficClass | ipv6.FlagHopLimit | ipv6.FlagInterface | ipv6.FlagPathMTU cf := ipv6.FlagTrafficClass | ipv6.FlagHopLimit | ipv6.FlagSrc | ipv6.FlagDst | ipv6.FlagInterface | ipv6.FlagPathMTU
if err := p.SetControlMessage(cf, true); err != nil { if err := p.SetControlMessage(cf, true); err != nil {
b.Fatalf("ipv6.PacketConn.SetControlMessage failed: %v", err) b.Fatalf("ipv6.PacketConn.SetControlMessage failed: %v", err)
} }
...@@ -117,6 +117,13 @@ func TestPacketConnConcurrentReadWriteUnicastUDP(t *testing.T) { ...@@ -117,6 +117,13 @@ func TestPacketConnConcurrentReadWriteUnicastUDP(t *testing.T) {
cf := ipv6.FlagTrafficClass | ipv6.FlagHopLimit | ipv6.FlagSrc | ipv6.FlagDst | ipv6.FlagInterface | ipv6.FlagPathMTU cf := ipv6.FlagTrafficClass | ipv6.FlagHopLimit | ipv6.FlagSrc | ipv6.FlagDst | ipv6.FlagInterface | ipv6.FlagPathMTU
wb := []byte("HELLO-R-U-THERE") wb := []byte("HELLO-R-U-THERE")
if err := p.SetControlMessage(cf, true); err != nil { // probe before test
if nettest.ProtocolNotSupported(err) {
t.Skipf("not supported on %q", runtime.GOOS)
}
t.Fatalf("ipv6.PacketConn.SetControlMessage failed: %v", err)
}
var wg sync.WaitGroup var wg sync.WaitGroup
reader := func() { reader := func() {
defer wg.Done() defer wg.Done()
......
...@@ -53,6 +53,9 @@ func TestPacketConnReadWriteUnicastUDP(t *testing.T) { ...@@ -53,6 +53,9 @@ func TestPacketConnReadWriteUnicastUDP(t *testing.T) {
for i, toggle := range []bool{true, false, true} { for i, toggle := range []bool{true, false, true} {
if err := p.SetControlMessage(cf, toggle); err != nil { if err := p.SetControlMessage(cf, toggle); err != nil {
if nettest.ProtocolNotSupported(err) {
t.Skipf("not supported on %q", runtime.GOOS)
}
t.Fatalf("ipv6.PacketConn.SetControlMessage failed: %v", err) t.Fatalf("ipv6.PacketConn.SetControlMessage failed: %v", err)
} }
cm.HopLimit = i + 1 cm.HopLimit = i + 1
...@@ -145,6 +148,9 @@ func TestPacketConnReadWriteUnicastICMP(t *testing.T) { ...@@ -145,6 +148,9 @@ func TestPacketConnReadWriteUnicastICMP(t *testing.T) {
t.Fatalf("icmp.Message.Marshal failed: %v", err) t.Fatalf("icmp.Message.Marshal failed: %v", err)
} }
if err := p.SetControlMessage(cf, toggle); err != nil { if err := p.SetControlMessage(cf, toggle); err != nil {
if nettest.ProtocolNotSupported(err) {
t.Skipf("not supported on %q", runtime.GOOS)
}
t.Fatalf("ipv6.PacketConn.SetControlMessage failed: %v", err) t.Fatalf("ipv6.PacketConn.SetControlMessage failed: %v", err)
} }
cm.HopLimit = i + 1 cm.HopLimit = i + 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment