diff options
Diffstat (limited to 'libgo/go/net/dial_unix_test.go')
-rw-r--r-- | libgo/go/net/dial_unix_test.go | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/libgo/go/net/dial_unix_test.go b/libgo/go/net/dial_unix_test.go index 4b9bc279205..45d032c3e71 100644 --- a/libgo/go/net/dial_unix_test.go +++ b/libgo/go/net/dial_unix_test.go @@ -3,17 +3,23 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || hurd || linux || netbsd || openbsd || solaris -// +build aix darwin dragonfly freebsd hurd linux netbsd openbsd solaris package net import ( "context" + "errors" "syscall" "testing" "time" ) +func init() { + isEADDRINUSE = func(err error) bool { + return errors.Is(err, syscall.EADDRINUSE) + } +} + // Issue 16523 func TestDialContextCancelRace(t *testing.T) { oldConnectFunc := connectFunc @@ -25,10 +31,7 @@ func TestDialContextCancelRace(t *testing.T) { testHookCanceledDial = oldTestHookCanceledDial }() - ln, err := newLocalListener("tcp") - if err != nil { - t.Fatal(err) - } + ln := newLocalListener(t, "tcp") listenerDone := make(chan struct{}) go func() { defer close(listenerDone) |