diff options
| author | Mark Johnston <markj@FreeBSD.org> | 2022-01-14 20:00:01 +0000 |
|---|---|---|
| committer | Mark Johnston <markj@FreeBSD.org> | 2022-01-21 00:52:36 +0000 |
| commit | 812345b1d469e5bb90f5487fef1e4ab16890cc7a (patch) | |
| tree | aee94676d3183c97478f0db943ea55e8ba175fdc | |
| parent | 2077f85a63f2855fd0e1658d3655b60302db6ebd (diff) | |
| download | src-812345b1d469e5bb90f5487fef1e4ab16890cc7a.tar.gz src-812345b1d469e5bb90f5487fef1e4ab16890cc7a.zip | |
netbsd-tests: Fix the libc stat_socket test
The test tries to connect a socket to a closed port at 127.0.0.1. It
sets O_NONBLOCK on the socket first and expects to get EINPROGRESS from
connect(2), but this is not guaranteed, ECONNREFUSED is possible.
Handle both cases, and re-enable the test.
PR: 240621
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 95c75073d3d1ca9dcae41784453172f199bb2c0f)
| -rw-r--r-- | contrib/netbsd-tests/lib/libc/sys/t_stat.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_stat.c b/contrib/netbsd-tests/lib/libc/sys/t_stat.c index 372a9093fac5..029ff8452d94 100644 --- a/contrib/netbsd-tests/lib/libc/sys/t_stat.c +++ b/contrib/netbsd-tests/lib/libc/sys/t_stat.c @@ -332,9 +332,6 @@ ATF_TC_BODY(stat_socket, tc) uint32_t iaddr; int fd, flags; - if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) - atf_tc_skip("https://bugs.freebsd.org/240621"); - (void)memset(&st, 0, sizeof(struct stat)); (void)memset(&addr, 0, sizeof(struct sockaddr_in)); @@ -353,14 +350,14 @@ ATF_TC_BODY(stat_socket, tc) errno = 0; - ATF_REQUIRE_ERRNO(EINPROGRESS, - connect(fd, (struct sockaddr *)&addr, - sizeof(struct sockaddr_in)) == -1); + ATF_REQUIRE(connect(fd, (struct sockaddr *)&addr, + sizeof(struct sockaddr_in)) == -1); + ATF_REQUIRE(errno == EINPROGRESS || errno == ECONNREFUSED); errno = 0; if (fstat(fd, &st) != 0 || errno != 0) - atf_tc_fail("fstat(2) failed for a EINPROGRESS socket"); + atf_tc_fail("fstat(2) failed for a socket"); (void)close(fd); } |
