diff --git a/src/log/syslog/syslog_test.go b/src/log/syslog/syslog_test.go index 85aec536abe..52363f9f7c2 100644 --- a/src/log/syslog/syslog_test.go +++ b/src/log/syslog/syslog_test.go @@ -47,6 +47,22 @@ func runPktSyslog(c net.PacketConn, done chan<- string) { var crashy = false +func testableNetwork(network string) bool { + switch network { + case "unix", "unixgram": + switch runtime.GOOS { + case "darwin": + switch runtime.GOARCH { + case "arm", "arm64": + return false + } + case "android": + return false + } + } + return true +} + func runStreamSyslog(l net.Listener, done chan<- string, wg *sync.WaitGroup) { for { var c net.Conn @@ -119,12 +135,10 @@ func startServer(n, la string, done chan<- string) (addr string, sock io.Closer, func TestWithSimulated(t *testing.T) { msg := "Test 123" - transport := []string{"unix", "unixgram", "udp", "tcp"} - - if runtime.GOOS == "darwin" { - switch runtime.GOARCH { - case "arm", "arm64": - transport = []string{"udp", "tcp"} + var transport []string + for _, n := range []string{"unix", "unixgram", "udp", "tcp"} { + if testableNetwork(n) { + transport = append(transport, n) } } @@ -150,14 +164,11 @@ func TestWithSimulated(t *testing.T) { } func TestFlap(t *testing.T) { - if runtime.GOOS == "darwin" { - switch runtime.GOARCH { - case "arm", "arm64": - t.Skipf("skipping on %s/%s", runtime.GOOS, runtime.GOARCH) - } + net := "unix" + if !testableNetwork(net) { + t.Skipf("skipping on %s/%s; 'unix' is not supported", runtime.GOOS, runtime.GOARCH) } - net := "unix" done := make(chan string) addr, sock, srvWG := startServer(net, "", done) defer srvWG.Wait() @@ -321,10 +332,10 @@ func TestConcurrentReconnect(t *testing.T) { const N = 10 const M = 100 net := "unix" - if runtime.GOOS == "darwin" { - switch runtime.GOARCH { - case "arm", "arm64": - net = "tcp" + if !testableNetwork(net) { + net = "tcp" + if !testableNetwork(net) { + t.Skipf("skipping on %s/%s; neither 'unix' or 'tcp' is supported", runtime.GOOS, runtime.GOARCH) } } done := make(chan string, N*M)