poll tests: Avoid test failure on AIX.
authorBruno Haible <bruno@clisp.org>
Thu, 31 Dec 2020 22:49:25 +0000 (23:49 +0100)
committerBruno Haible <bruno@clisp.org>
Thu, 31 Dec 2020 22:49:25 +0000 (23:49 +0100)
* 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
doc/posix-functions/poll.texi
tests/test-poll.c

index f2d18546e09c268b0759e0d90583de8ef1c51257..bf98e8005ce6644379bab707c876b59258e52f01 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2020-12-31  Bruno Haible  <bruno@clisp.org>
+
+       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  <bruno@clisp.org>
 
        poll tests: Avoid test failure on BSD and Solaris systems.
index a04d3b8b189b4c85edb5a8cfbe5d3ff7e4c70414..c1efe87ad9c4b216fda315d94f1273ddddd2964c 100644 (file)
@@ -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
index 05248d8f8f991cea182bfd8b7e1b9cb841682858..5105620ab07bb0739a0513f5db6e2232db502897 100644 (file)
@@ -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]);
 }