tests/kqueue: repair flaky test

The test arms timer for 500 msec and then sleeps 1 second and expects that
the timer would always fire exactly 2 times.  However, it has a chance to
legitimately fire only once.  This makes the test flaky.  Fix the test
reducing sleep time down to 495 msec.

The problem started to show up recently, and I attribute that to
626ea75ed2.  Before this revision sleep(3) was almost always sleeping
over 1000 msec, now it can sleep exactly 1000 msec.

Reviewed by:		markj
Differential Revision:	https://reviews.freebsd.org/D50996
This commit is contained in:
Gleb Smirnoff 2025-06-24 15:28:07 -07:00
parent d17cbe4698
commit 994bec47ee

View file

@ -199,7 +199,7 @@ test_periodic_modify(void)
kevent_cmp(&kev, kevent_get(kqfd));
/* Check if the event occurs again */
EV_SET(&kev, vnode_fd, EVFILT_TIMER, EV_ADD, 0, 500, NULL);
EV_SET(&kev, vnode_fd, EVFILT_TIMER, EV_ADD, 0, 495, NULL);
if (kevent(kqfd, &kev, 1, NULL, 0, NULL) < 0)
err(1, "%s", test_id);