From 83734d96bb98304a6611c27163e59aa2eeba492f Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 31 Dec 2020 23:38:16 +0100 Subject: [PATCH] poll tests: Avoid test failure on BSD and Solaris systems. * tests/test-poll.c (test_accept_first, test_socket_pair): Disable the "expecting POLLHUP after shutdown" test on all platforms except Linux. --- ChangeLog | 6 ++++++ tests/test-poll.c | 14 ++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 661a1ee94d..f2d18546e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2020-12-31 Bruno Haible + + poll tests: Avoid test failure on BSD and Solaris systems. + * tests/test-poll.c (test_accept_first, test_socket_pair): Disable the + "expecting POLLHUP after shutdown" test on all platforms except Linux. + 2020-12-31 Paul Eggert fnmatch: merge from glibc + proposal diff --git a/tests/test-poll.c b/tests/test-poll.c index 3566031bb3..05248d8f8f 100644 --- a/tests/test-poll.c +++ b/tests/test-poll.c @@ -280,8 +280,13 @@ test_accept_first (void) failed ("cannot read data left in the socket by closed process"); ASSERT (read (c, buf, 3) == 3); ASSERT (write (c, "foo", 3) == 3); - if ((poll1_wait (c, POLLIN | POLLOUT) & (POLLHUP | POLLERR)) == 0) + int revents = poll1_wait (c, POLLIN | POLLOUT); +# ifdef __linux__ + if ((revents & (POLLHUP | POLLERR)) == 0) failed ("expecting POLLHUP after shutdown"); +# else + (void) revents; +# endif close (c); } #endif @@ -335,8 +340,13 @@ test_socket_pair (void) test_pair (c1, c2); close (c1); ASSERT (write (c2, "foo", 3) == 3); - if ((poll1_nowait (c2, POLLIN | POLLOUT) & (POLLHUP | POLLERR)) == 0) + int revents = poll1_nowait (c2, POLLIN | POLLOUT); +#ifdef __linux__ + if ((revents & (POLLHUP | POLLERR)) == 0) failed ("expecting POLLHUP after shutdown"); +#else + (void) revents; +#endif close (c2); } -- 2.39.5