Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/lib/libc/sys In the fifo_hup1 test, also ensure that P...



details:   https://anonhg.NetBSD.org/src/rev/f632cfdffa1f
branches:  trunk
changeset: 1023919:f632cfdffa1f
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat Oct 02 14:41:36 2021 +0000

description:
In the fifo_hup1 test, also ensure that POLLHUP is de-asserted when a
new writer appears.

diffstat:

 tests/lib/libc/sys/t_poll.c |  14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diffs (28 lines):

diff -r e9189f27b248 -r f632cfdffa1f tests/lib/libc/sys/t_poll.c
--- a/tests/lib/libc/sys/t_poll.c       Sat Oct 02 14:28:04 2021 +0000
+++ b/tests/lib/libc/sys/t_poll.c       Sat Oct 02 14:41:36 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_poll.c,v 1.5 2021/10/02 02:07:41 thorpej Exp $       */
+/*     $NetBSD: t_poll.c,v 1.6 2021/10/02 14:41:36 thorpej Exp $       */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -278,6 +278,18 @@
 
        ATF_REQUIRE(poll(&pfd, 1, 0) == 1);
        ATF_REQUIRE((pfd.revents & POLLHUP) != 0);
+
+       /*
+        * Check that POLLHUP is cleared when a writer re-connects.
+        * Since the writer will not put any data into the FIFO, we
+        * expect no events.
+        */
+       memset(&pfd, 0, sizeof(pfd));
+       pfd.fd = rfd;
+       pfd.events = POLLIN;
+
+       ATF_REQUIRE((wfd = open(fifo_path, O_WRONLY)) >= 0);
+       ATF_REQUIRE(poll(&pfd, 1, 0) == 0);
 }
 
 ATF_TC_CLEANUP(fifo_hup1, tc)



Home | Main Index | Thread Index | Old Index