summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2023-07-08 15:32:58 +0000
committerriastradh <riastradh@NetBSD.org>2023-07-08 15:32:58 +0000
commit96e65dba728fddd2104244f530812358469a0896 (patch)
tree603a0ed1ae95e4842ce3c33ee95b76d2b8607dfe /tests
parent65989024f874330227db7d9793fa78cab7c0ee2f (diff)
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.
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/libc/sys/t_timerfd.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/tests/lib/libc/sys/t_timerfd.c b/tests/lib/libc/sys/t_timerfd.c
index d26245fa160..e3a4652e39a 100644
--- a/tests/lib/libc/sys/t_timerfd.c
+++ b/tests/lib/libc/sys/t_timerfd.c
@@ -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);
}