@@ -8,6 +8,7 @@ package net
8
8
9
9
import (
10
10
"fmt"
11
+ "internal/testenv"
11
12
"reflect"
12
13
"runtime"
13
14
"testing"
@@ -50,10 +51,20 @@ func ipv6LinkLocalUnicastAddr(ifi *Interface) string {
50
51
return ""
51
52
}
52
53
53
- func TestInterfaces (t * testing.T ) {
54
- if runtime .GOOS == "darwin" && (runtime .GOARCH == "arm" || runtime .GOARCH == "arm64" ) {
55
- t .Skipf ("sysctl is not supported on iOS" )
54
+ func condSkipInterfaceTest (t * testing.T ) {
55
+ t .Helper ()
56
+ switch runtime .GOOS {
57
+ case "darwin" :
58
+ if runtime .GOARCH == "arm" || runtime .GOARCH == "arm64" {
59
+ t .Skipf ("sysctl is not supported on iOS" )
60
+ }
61
+ case "dragonfly" :
62
+ testenv .SkipFlaky (t , 34368 )
56
63
}
64
+ }
65
+
66
+ func TestInterfaces (t * testing.T ) {
67
+ condSkipInterfaceTest (t )
57
68
ift , err := Interfaces ()
58
69
if err != nil {
59
70
t .Fatal (err )
@@ -85,9 +96,7 @@ func TestInterfaces(t *testing.T) {
85
96
}
86
97
87
98
func TestInterfaceAddrs (t * testing.T ) {
88
- if runtime .GOOS == "darwin" && (runtime .GOARCH == "arm" || runtime .GOARCH == "arm64" ) {
89
- t .Skipf ("sysctl is not supported on iOS" )
90
- }
99
+ condSkipInterfaceTest (t )
91
100
ift , err := Interfaces ()
92
101
if err != nil {
93
102
t .Fatal (err )
@@ -107,9 +116,7 @@ func TestInterfaceAddrs(t *testing.T) {
107
116
}
108
117
109
118
func TestInterfaceUnicastAddrs (t * testing.T ) {
110
- if runtime .GOOS == "darwin" && (runtime .GOARCH == "arm" || runtime .GOARCH == "arm64" ) {
111
- t .Skipf ("sysctl is not supported on iOS" )
112
- }
119
+ condSkipInterfaceTest (t )
113
120
ift , err := Interfaces ()
114
121
if err != nil {
115
122
t .Fatal (err )
@@ -137,9 +144,7 @@ func TestInterfaceUnicastAddrs(t *testing.T) {
137
144
}
138
145
139
146
func TestInterfaceMulticastAddrs (t * testing.T ) {
140
- if runtime .GOOS == "darwin" && (runtime .GOARCH == "arm" || runtime .GOARCH == "arm64" ) {
141
- t .Skipf ("sysctl is not supported on iOS" )
142
- }
147
+ condSkipInterfaceTest (t )
143
148
ift , err := Interfaces ()
144
149
if err != nil {
145
150
t .Fatal (err )
0 commit comments