summaryrefslogtreecommitdiff
path: root/tests/kernel/kqueue
diff options
context:
space:
mode:
authorthorpej <thorpej@NetBSD.org>2021-10-22 13:53:20 +0000
committerthorpej <thorpej@NetBSD.org>2021-10-22 13:53:20 +0000
commit7e775072dff038372baf66b89922c9a2cf390405 (patch)
tree3c0a7efcdd721955604e8f73d5827049b23d1374 /tests/kernel/kqueue
parent8ca1e26be0eb63b8de71c57d33e96c19fe9dc35c (diff)
In the "modify" test case, immediately after modifying the timer, validate
that its associated knote in the kernel has actually been deactivated.
Diffstat (limited to 'tests/kernel/kqueue')
-rw-r--r--tests/kernel/kqueue/t_timer.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/kernel/kqueue/t_timer.c b/tests/kernel/kqueue/t_timer.c
index 1a0782a9360..ea2a2e6745e 100644
--- a/tests/kernel/kqueue/t_timer.c
+++ b/tests/kernel/kqueue/t_timer.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_timer.c,v 1.2 2021/10/22 04:49:24 thorpej Exp $ */
+/* $NetBSD: t_timer.c,v 1.3 2021/10/22 13:53:20 thorpej Exp $ */
/*-
* Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_timer.c,v 1.2 2021/10/22 04:49:24 thorpej Exp $");
+__RCSID("$NetBSD: t_timer.c,v 1.3 2021/10/22 13:53:20 thorpej Exp $");
#include <sys/types.h>
#include <sys/event.h>
@@ -208,6 +208,12 @@ ATF_TC_BODY(modify, tc)
EV_SET(&event[0], 1, EVFILT_TIMER, EV_ADD, 0, 4000, NULL);
ATF_REQUIRE(kevent(kq, event, 1, NULL, 0, NULL) == 0);
+ /*
+ * Before we sleep, verify that the knote for this timer is
+ * no longer activated.
+ */
+ ATF_REQUIRE(kevent(kq, NULL, 0, event, 1, &ts) == 0);
+
sleepts.tv_sec = 5;
sleepts.tv_nsec = 0;
ATF_REQUIRE(nanosleep(&sleepts, NULL) == 0);