rt/tst-clock_nanosleep2 failure

Mark Wielaard mark@klomp.org
Tue Jan 14 00:38:08 GMT 2025


Hi,

I was testing current glibc trunk on a rpi-pi-f3 () box with fedora 40
installed. The results of make -j8 with TIMEOUTFACTOR=4 look pretty
good:

UNSUPPORTED: assert/tst-assert-c++
UNSUPPORTED: assert/tst-assert-g++
UNSUPPORTED: debug/tst-fortify-cc-default-1-def
UNSUPPORTED: debug/tst-fortify-cc-default-2-def
UNSUPPORTED: debug/tst-fortify-cc-default-3-def
UNSUPPORTED: debug/tst-fortify-cc-lfs-1-def
UNSUPPORTED: debug/tst-fortify-cc-lfs-2-def
UNSUPPORTED: debug/tst-fortify-cc-lfs-3-def
UNSUPPORTED: debug/tst-fortify-cc-nongnu-1-def
UNSUPPORTED: debug/tst-fortify-cc-nongnu-2-def
UNSUPPORTED: debug/tst-fortify-cc-nongnu-3-def
UNSUPPORTED: dlfcn/bug-atexit3
UNSUPPORTED: elf/tst-decorate-maps
UNSUPPORTED: elf/tst-env-setuid
XPASS: elf/tst-protected1a
XPASS: elf/tst-protected1b
UNSUPPORTED: elf/tst-valgrind-smoke
UNSUPPORTED: io/tst-faccessat-setuid
UNSUPPORTED: libio/tst-fopen-compat
UNSUPPORTED: math/test-ceil-except-2
UNSUPPORTED: math/test-fesetexcept-traps
UNSUPPORTED: math/test-fexcept-traps
UNSUPPORTED: math/test-floor-except-2
UNSUPPORTED: math/test-nearbyint-except-2
UNSUPPORTED: math/test-trunc-except-2
UNSUPPORTED: misc/tst-adjtimex
UNSUPPORTED: misc/tst-clock_adjtime
UNSUPPORTED: misc/tst-epoll-ioctls
UNSUPPORTED: misc/tst-ntp_adjtime
UNSUPPORTED: misc/tst-pkey
UNSUPPORTED: nptl/test-cond-printers
UNSUPPORTED: nptl/test-condattr-printers
UNSUPPORTED: nptl/test-mutex-printers
UNSUPPORTED: nptl/test-mutexattr-printers
UNSUPPORTED: nptl/test-rwlock-printers
UNSUPPORTED: nptl/test-rwlockattr-printers
UNSUPPORTED: nptl/tst-cancel24
UNSUPPORTED: nptl/tst-cancel24-static
UNSUPPORTED: nptl/tst-minstack-throw
UNSUPPORTED: nptl/tst-once5
UNSUPPORTED: nptl/tst-thread-exit-clobber
UNSUPPORTED: nptl/tst-thread_local1
UNSUPPORTED: posix/tst-spawn-cgroup
FAIL: rt/tst-clock_nanosleep2
UNSUPPORTED: stdlib/tst-quick_exit
UNSUPPORTED: stdlib/tst-thread-quick_exit
UNSUPPORTED: time/tst-clock_settime
UNSUPPORTED: time/tst-settimeofday
		=== Summary of results ===
      1 FAIL
   5540 PASS
     45 UNSUPPORTED
     16 XFAIL
      2 XPASS

The lonely failure is because some clocks have a precision which is
(much) larger than TEST_NSEC / 10. TEST_NSEC is the time the test
sleeps to check the clock resolution.

This is fixable by just increasing the TEST_NSEC to 40000000 (from
1000000). But it might be better to just skip testing such clocks.

The attached does that and improves the logging a little.

Cheers,

Mark
-------------- next part --------------
>From 9b41b9247c743c5f6881570cf141db50c0162b26 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Tue, 14 Jan 2025 01:30:40 +0100
Subject: [PATCH] rt: skip nanosleep interval and abs test for low precision
 clocks

If a clock doesn't have enough precision to check the sleep resolution
(quantum.tv_nsec > TEST_NSEC / 10) then record the quantum.tv_nsec,
but skip the interval_test and abs_test for that clock.
---
 rt/tst-clock_nanosleep2.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/rt/tst-clock_nanosleep2.c b/rt/tst-clock_nanosleep2.c
index 4a852cff1180..d59b75e30b69 100644
--- a/rt/tst-clock_nanosleep2.c
+++ b/rt/tst-clock_nanosleep2.c
@@ -87,9 +87,14 @@ test_interval_1 (const char *n_clock, clockid_t t_clock)
   /* Arbitrary to ensure our time period is sufficiently bigger than
      the time step.  */
   TEST_VERIFY (clock_getres (t_clock, &quantum) == 0);
-  printf("Clock quantum: %lld ns, test time: %lld ns\n",
+  printf("%s quantum: %lld ns, test time: %lld ns\n", n_clock,
 	 (long long int) quantum.tv_nsec, (long long int) TEST_NSEC);
-  TEST_VERIFY (quantum.tv_nsec <= TEST_NSEC / 10);
+  if (quantum.tv_nsec > TEST_NSEC / 10)
+    {
+      printf ("SKIPPING test_interval for clock %s, not enough precision\n",
+	      n_clock);
+      return;
+    }
 
   min_slept = TEST_NSEC;
 
@@ -125,9 +130,14 @@ test_abs_1 (const char *n_clock, clockid_t t_clock)
   /* Arbitrary to ensure our time period is sufficiently bigger than
      the time step.  */
   TEST_VERIFY (clock_getres (t_clock, &quantum) == 0);
-  printf("Clock quantum: %lld ns, test time: %lld ns\n",
+  printf("%s quantum: %lld ns, test time: %lld ns\n", n_clock,
 	 (long long int) quantum.tv_nsec, (long long int) TEST_NSEC);
-  TEST_VERIFY (quantum.tv_nsec <= TEST_NSEC / 10);
+  if (quantum.tv_nsec > TEST_NSEC / 10)
+    {
+      printf ("SKIPPING test_abs for clock %s, not enough precision\n",
+	      n_clock);
+      return;
+    }
 
   me_sleep = make_timespec (0,  TEST_NSEC);
 
-- 
2.47.1



More information about the Libc-alpha mailing list