]> Savannah Git Hosting - gnulib.git/commitdiff
poll tests: Avoid test failure on BSD and Solaris systems.
authorBruno Haible <bruno@clisp.org>
Thu, 31 Dec 2020 22:38:16 +0000 (23:38 +0100)
committerBruno Haible <bruno@clisp.org>
Thu, 31 Dec 2020 22:40:08 +0000 (23:40 +0100)
* tests/test-poll.c (test_accept_first, test_socket_pair): Disable the
"expecting POLLHUP after shutdown" test on all platforms except Linux.

ChangeLog
tests/test-poll.c

index 661a1ee94d023f771d7f0b2a5737b91d775c8cd7..f2d18546e09c268b0759e0d90583de8ef1c51257 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2020-12-31  Bruno Haible  <bruno@clisp.org>
+
+       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  <eggert@cs.ucla.edu>
 
        fnmatch: merge from glibc + proposal
index 3566031bb3186a56296e5d9840328b411112b2ca..05248d8f8f991cea182bfd8b7e1b9cb841682858 100644 (file)
@@ -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);
 }