Module Name: src
Committed By: gson
Date: Sat Jul 13 12:44:02 UTC 2019
Modified Files:
src/tests/lib/libc/sys: t_getitimer.c
Log Message:
In the setitimer_old test case, allow for time passing between the two
setitimer() calls. Should fix PR kern/54370.
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/sys/t_getitimer.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/lib/libc/sys/t_getitimer.c
diff -u src/tests/lib/libc/sys/t_getitimer.c:1.2 src/tests/lib/libc/sys/t_getitimer.c:1.3
--- src/tests/lib/libc/sys/t_getitimer.c:1.2 Thu Mar 22 18:20:46 2012
+++ src/tests/lib/libc/sys/t_getitimer.c Sat Jul 13 12:44:02 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: t_getitimer.c,v 1.2 2012/03/22 18:20:46 christos Exp $ */
+/* $NetBSD: t_getitimer.c,v 1.3 2019/07/13 12:44:02 gson Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_getitimer.c,v 1.2 2012/03/22 18:20:46 christos Exp $");
+__RCSID("$NetBSD: t_getitimer.c,v 1.3 2019/07/13 12:44:02 gson Exp $");
#include <sys/time.h>
@@ -175,11 +175,13 @@ ATF_TC_BODY(setitimer_old, tc)
struct itimerval it, ot;
/*
- * Make two calls; the second one
- * should store the old values.
+ * Make two calls; the second one should store the old
+ * timer value which should be the same as that set in
+ * the first call, or slightly less due to time passing
+ * between the two calls.
*/
it.it_value.tv_sec = 4;
- it.it_value.tv_usec = 3;
+ it.it_value.tv_usec = 999999;
it.it_interval.tv_sec = 0;
it.it_interval.tv_usec = 0;
@@ -194,7 +196,8 @@ ATF_TC_BODY(setitimer_old, tc)
ATF_REQUIRE(setitimer(ITIMER_REAL, &it, &ot) == 0);
- if (ot.it_value.tv_sec != 4 || ot.it_value.tv_usec != 3)
+ /* Check seconds only as microseconds may have decremented */
+ if (ot.it_value.tv_sec != 4)
atf_tc_fail("setitimer(2) did not store old values");
}