Skip to content

Commit

Permalink
unix: skip ip related tests if EAFNOSUPPORT raised
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
mengzhuo authored and gopherbot committed Mar 4, 2023
1 parent c7a1bf9 commit 494aa49
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions unix/creds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func TestPktInfo(t *testing.T) {
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 {
Expand Down Expand Up @@ -208,7 +208,7 @@ func TestParseOrigDstAddr(t *testing.T) {
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 {
Expand Down

0 comments on commit 494aa49

Please sign in to comment.