summaryrefslogtreecommitdiff
path: root/tests/lib/libc/sys
diff options
context:
space:
mode:
authorthorpej <thorpej@NetBSD.org>2021-10-02 14:41:36 +0000
committerthorpej <thorpej@NetBSD.org>2021-10-02 14:41:36 +0000
commit4bcac9069fbd01b019136439eb5d88ad1b7fa59a (patch)
treeb1f2a7e332ed1e2f018d496d0971a91fa519a01e /tests/lib/libc/sys
parent55878453c33deb423bc3f7bcbe10964b1c4aa519 (diff)
In the fifo_hup1 test, also ensure that POLLHUP is de-asserted when a
new writer appears.
Diffstat (limited to 'tests/lib/libc/sys')
-rw-r--r--tests/lib/libc/sys/t_poll.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/lib/libc/sys/t_poll.c b/tests/lib/libc/sys/t_poll.c
index 7c560296cfd..1c12d01736f 100644
--- a/tests/lib/libc/sys/t_poll.c
+++ b/tests/lib/libc/sys/t_poll.c
@@ -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_TC_BODY(fifo_hup1, tc)
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)