unix: skip ip related tests if EAFNOSUPPORT raised Skipping EADDRNOTAVAIL is not enough for system doesn't support ipv4/ipv6 family. This CL skips TestPktInfo and TestParseOrigDstAddr if EAFNOSUPPORT raised. Fixes golang/go#58832 Change-Id: Icf74749f9cc0f9a6d60646f92f7ddf53ae2de8ab Reviewed-on: https://go-review.googlesource.com/c/sys/+/473257 Run-TryBot: M Zhuo <mzh@golangcn.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
diff --git a/unix/creds_test.go b/unix/creds_test.go index 9ab57ec..32d251f 100644 --- a/unix/creds_test.go +++ b/unix/creds_test.go
@@ -132,7 +132,7 @@ for _, test := range testcases { t.Run(test.network, func(t *testing.T) { conn, err := net.ListenUDP(test.network, test.address) - if errors.Is(err, unix.EADDRNOTAVAIL) { + if errors.Is(err, unix.EADDRNOTAVAIL) || errors.Is(err, unix.EAFNOSUPPORT) { t.Skipf("%v is not available", test.address) } if err != nil { @@ -208,7 +208,7 @@ for _, test := range testcases { t.Run(test.network, func(t *testing.T) { conn, err := net.ListenUDP(test.network, test.address) - if errors.Is(err, unix.EADDRNOTAVAIL) { + if errors.Is(err, unix.EADDRNOTAVAIL) || errors.Is(err, unix.EAFNOSUPPORT) { t.Skipf("%v is not available", test.address) } if err != nil {