Module Name:    src
Committed By:   riastradh
Date:           Sat Jul  8 15:32:58 UTC 2023

Modified Files:
        src/tests/lib/libc/sys: t_timerfd.c

Log Message:
t_timerfd: Sprinkle slightly more diagnostics.

Might help us to see if we're off by just a little bit (maybe a tiny
jitter between the hardclock timer and the monotonic clock), or if
something is seriously amiss when the timerfd_block test fails
sporadically.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libc/sys/t_timerfd.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_timerfd.c
diff -u src/tests/lib/libc/sys/t_timerfd.c:1.4 src/tests/lib/libc/sys/t_timerfd.c:1.5
--- src/tests/lib/libc/sys/t_timerfd.c:1.4	Sun Feb 20 15:21:14 2022
+++ src/tests/lib/libc/sys/t_timerfd.c	Sat Jul  8 15:32:58 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: t_timerfd.c,v 1.4 2022/02/20 15:21:14 thorpej Exp $ */
+/* $NetBSD: t_timerfd.c,v 1.5 2023/07/08 15:32:58 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 #include <sys/cdefs.h>
 __COPYRIGHT("@(#) Copyright (c) 2020\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_timerfd.c,v 1.4 2022/02/20 15:21:14 thorpej Exp $");
+__RCSID("$NetBSD: t_timerfd.c,v 1.5 2023/07/08 15:32:58 riastradh Exp $");
 
 #include <sys/types.h>
 #include <sys/event.h>
@@ -195,7 +195,11 @@ ATF_TC_BODY(timerfd_block, tc)
 	ATF_REQUIRE(check_value_against_bounds(val, 1, 1));
 
 	timespecsub(&now, &then, &delta);
-	ATF_REQUIRE(check_value_against_bounds(delta.tv_sec, 1, 1));
+	ATF_REQUIRE_MSG(check_value_against_bounds(delta.tv_sec, 1, 1),
+	    "then=%jd.%09lu now=%jd.%09lu delta=%jd.%09lu",
+	    (intmax_t)then.tv_sec, then.tv_nsec,
+	    (intmax_t)now.tv_sec, now.tv_nsec,
+	    (intmax_t)delta.tv_sec, delta.tv_nsec);
 
 	(void) close(fd);
 }
@@ -230,7 +234,11 @@ ATF_TC_BODY(timerfd_repeating, tc)
 	ATF_REQUIRE(check_value_against_bounds(val, 3, 5));
 
 	timespecsub(&now, &then, &delta);
-	ATF_REQUIRE(check_value_against_bounds(delta.tv_sec, 1, 1));
+	ATF_REQUIRE_MSG(check_value_against_bounds(delta.tv_sec, 1, 1),
+	    "then=%jd.%09lu now=%jd.%09lu delta=%jd.%09lu",
+	    (intmax_t)then.tv_sec, then.tv_nsec,
+	    (intmax_t)now.tv_sec, now.tv_nsec,
+	    (intmax_t)delta.tv_sec, delta.tv_nsec);
 
 	(void) close(fd);
 }
@@ -264,7 +272,11 @@ ATF_TC_BODY(timerfd_abstime, tc)
 	ATF_REQUIRE(check_value_against_bounds(val, 1, 1));
 
 	timespecsub(&now, &then, &delta);
-	ATF_REQUIRE(check_value_against_bounds(delta.tv_sec, 1, 1));
+	ATF_REQUIRE_MSG(check_value_against_bounds(delta.tv_sec, 1, 1),
+	    "then=%jd.%09lu now=%jd.%09lu delta=%jd.%09lu",
+	    (intmax_t)then.tv_sec, then.tv_nsec,
+	    (intmax_t)now.tv_sec, now.tv_nsec,
+	    (intmax_t)delta.tv_sec, delta.tv_nsec);
 
 	(void) close(fd);
 }

Reply via email to