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/6e1b916851f1
branches:  trunk
changeset: 988194:6e1b916851f1
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 c353a6564ef2 -r 6e1b916851f1 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