[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
poll tests: Avoid test failure on AIX
From: |
Bruno Haible |
Subject: |
poll tests: Avoid test failure on AIX |
Date: |
Thu, 31 Dec 2020 23:54:07 +0100 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-197-generic; KDE/5.18.0; x86_64; ; ) |
Another POLLHUP test is failing on AIX, but here not for the sockets,
but for the pipes. This is an AIX bug w.r.t. POSIX. Since we cannot
easily work around it in Gnulib, this patch
- documents it,
- avoids a test failure (since I don't want to see it over and over
again, now that it's documented).
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.
diff --git a/doc/posix-functions/poll.texi b/doc/posix-functions/poll.texi
index a04d3b8..c1efe87 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 05248d8..5105620 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]);
}