bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org
Subject: poll tests: Avoid test failure on AIX
Date: Thu, 31 Dec 2020 23:54:07 +0100	[thread overview]
Message-ID: <1622170.KMc9KUrPTa@omega> (raw)
In-Reply-To: <6145955.M0qUDR3Ujj@omega>

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]);
 }



      reply	other threads:[~2020-12-31 23:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-31 22:39 poll tests: Avoid test failure on BSD and Solaris systems Bruno Haible
2020-12-31 22:54 ` Bruno Haible [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1622170.KMc9KUrPTa@omega \
    --to=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).