@@ -47,6 +47,22 @@ func runPktSyslog(c net.PacketConn, done chan<- string) {
47
47
48
48
var crashy = false
49
49
50
+ func testableNetwork (network string ) bool {
51
+ switch network {
52
+ case "unix" , "unixgram" :
53
+ switch runtime .GOOS {
54
+ case "darwin" :
55
+ switch runtime .GOARCH {
56
+ case "arm" , "arm64" :
57
+ return false
58
+ }
59
+ case "android" :
60
+ return false
61
+ }
62
+ }
63
+ return true
64
+ }
65
+
50
66
func runStreamSyslog (l net.Listener , done chan <- string , wg * sync.WaitGroup ) {
51
67
for {
52
68
var c net.Conn
@@ -119,12 +135,10 @@ func startServer(n, la string, done chan<- string) (addr string, sock io.Closer,
119
135
120
136
func TestWithSimulated (t * testing.T ) {
121
137
msg := "Test 123"
122
- transport := []string {"unix" , "unixgram" , "udp" , "tcp" }
123
-
124
- if runtime .GOOS == "darwin" {
125
- switch runtime .GOARCH {
126
- case "arm" , "arm64" :
127
- transport = []string {"udp" , "tcp" }
138
+ var transport []string
139
+ for _ , n := range []string {"unix" , "unixgram" , "udp" , "tcp" } {
140
+ if testableNetwork (n ) {
141
+ transport = append (transport , n )
128
142
}
129
143
}
130
144
@@ -150,14 +164,11 @@ func TestWithSimulated(t *testing.T) {
150
164
}
151
165
152
166
func TestFlap (t * testing.T ) {
153
- if runtime .GOOS == "darwin" {
154
- switch runtime .GOARCH {
155
- case "arm" , "arm64" :
156
- t .Skipf ("skipping on %s/%s" , runtime .GOOS , runtime .GOARCH )
157
- }
167
+ net := "unix"
168
+ if ! testableNetwork (net ) {
169
+ t .Skipf ("skipping on %s/%s; 'unix' is not supported" , runtime .GOOS , runtime .GOARCH )
158
170
}
159
171
160
- net := "unix"
161
172
done := make (chan string )
162
173
addr , sock , srvWG := startServer (net , "" , done )
163
174
defer srvWG .Wait ()
@@ -321,10 +332,10 @@ func TestConcurrentReconnect(t *testing.T) {
321
332
const N = 10
322
333
const M = 100
323
334
net := "unix"
324
- if runtime . GOOS == "darwin" {
325
- switch runtime . GOARCH {
326
- case "arm" , "arm64" :
327
- net = " tcp"
335
+ if ! testableNetwork ( net ) {
336
+ net = "tcp"
337
+ if ! testableNetwork ( net ) {
338
+ t . Skipf ( "skipping on %s/%s; neither 'unix' or ' tcp' is supported" , runtime . GOOS , runtime . GOARCH )
328
339
}
329
340
}
330
341
done := make (chan string , N * M )
0 commit comments