From ae3a9135fe025f0a4e99f403e57cec09183bbd92 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 31 Dec 2020 23:49:25 +0100 Subject: [PATCH] poll tests: Avoid test failure on AIX. * tests/test-poll.c (test_pipe): Disable the "expecting POLLHUP after shutdown" test on AIX. * doc/posix-functions/poll.texi: Mention the AIX bug. --- ChangeLog | 7 +++++++ doc/posix-functions/poll.texi | 6 +++--- tests/test-poll.c | 7 ++++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index f2d18546e0..bf98e8005c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2020-12-31 Bruno Haible + + poll tests: Avoid test failure on AIX. + * tests/test-poll.c (test_pipe): Disable the "expecting POLLHUP after + shutdown" test on AIX. + * doc/posix-functions/poll.texi: Mention the AIX bug. + 2020-12-31 Bruno Haible poll tests: Avoid test failure on BSD and Solaris systems. diff --git a/doc/posix-functions/poll.texi b/doc/posix-functions/poll.texi index a04d3b8b18..c1efe87ad9 100644 --- a/doc/posix-functions/poll.texi +++ b/doc/posix-functions/poll.texi @@ -23,8 +23,8 @@ Portability problems not fixed by Gnulib: Under Windows, when passing a pipe, Gnulib's @code{poll} replacement might return 0 even before the timeout has passed. Programs using it with pipes can thus busy wait. - @item -Under HP NonStop, file descriptors other than sockets do not support -POLLHUP; they will return a "readable" status instead. +On some platforms, file descriptors other than sockets do not support +POLLHUP; they will return a "readable" or "writable" status instead: +AIX 7.2, HP NonStop. @end itemize diff --git a/tests/test-poll.c b/tests/test-poll.c index 05248d8f8f..5105620ab0 100644 --- a/tests/test-poll.c +++ b/tests/test-poll.c @@ -362,8 +362,13 @@ test_pipe (void) ASSERT (pipe (fd) >= 0); test_pair (fd[0], fd[1]); close (fd[0]); - if ((poll1_wait (fd[1], POLLIN | POLLOUT) & (POLLHUP | POLLERR)) == 0) + int revents = poll1_wait (fd[1], POLLIN | POLLOUT); +#if !defined _AIX + if ((revents & (POLLHUP | POLLERR)) == 0) failed ("expecting POLLHUP after shutdown"); +#else + (void) revents; +#endif close (fd[1]); } -- 2.39.5