Module Name: src
Committed By: thorpej
Date: Fri Oct 22 13:53:20 UTC 2021
Modified Files:
src/tests/kernel/kqueue: t_timer.c
Log Message:
In the "modify" test case, immediately after modifying the timer, validate
that its associated knote in the kernel has actually been deactivated.
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/kernel/kqueue/t_timer.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/kernel/kqueue/t_timer.c
diff -u src/tests/kernel/kqueue/t_timer.c:1.2 src/tests/kernel/kqueue/t_timer.c:1.3
--- src/tests/kernel/kqueue/t_timer.c:1.2 Fri Oct 22 04:49:24 2021
+++ src/tests/kernel/kqueue/t_timer.c Fri Oct 22 13:53:20 2021
@@ -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);