Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/lib/libc/sys In the setitimer_old test case, allow for...



details:   https://anonhg.NetBSD.org/src/rev/e4985816ab97
branches:  trunk
changeset: 842579:e4985816ab97
user:      gson <gson%NetBSD.org@localhost>
date:      Sat Jul 13 12:44:02 2019 +0000

description:
In the setitimer_old test case, allow for time passing between the two
setitimer() calls.  Should fix PR kern/54370.

diffstat:

 tests/lib/libc/sys/t_getitimer.c |  15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diffs (45 lines):

diff -r c7fc1d571218 -r e4985816ab97 tests/lib/libc/sys/t_getitimer.c
--- a/tests/lib/libc/sys/t_getitimer.c  Sat Jul 13 09:47:14 2019 +0000
+++ b/tests/lib/libc/sys/t_getitimer.c  Sat Jul 13 12:44:02 2019 +0000
@@ -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 @@
        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_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");
 }
 



Home | Main Index | Thread Index | Old Index