[CCing bug-gnulib]

Hi Santiago,

> test-pthread-cond (one of the gnulib tests) failed in this way on the
> "sparc64" architecture:
> 
> ../../build-aux/test-driver: line 119: 509191 Aborted                    "$@" 
> >> "$log_file" 2>&1
> FAIL: test-pthread-cond

Thanks for the report.

With a gnulib testdir for the 'pthread-cond' module, I reproduce it
9 out of 100 times on cfarm202.cfarm.net (which is a Debian Linux/SPARC).

The stack trace:

#0  0xfff80001003951b0 in __pthread_kill_implementation 
(threadid=18444492278191093600, signo=6, no_tid=0) at ./nptl/pthread_kill.c:43
#1  0xfff8000100342ba8 in __GI_raise (sig=6) at ../sysdeps/posix/raise.c:26
#2  0xfff800010032b8ac in __GI_abort () at ./stdlib/abort.c:73
#3  0x000001000000216c in test_pthread_cond_timedwait () at 
../../gltests/test-pthread-cond.c:232
#4  0x0000010000002614 in main () at ../../gltests/test-pthread-cond.c:280

I also observe similar failures in 'test-cond' and 'test-cnd'.

Changing the type of 'cond_timed_out' from 'int volatile' to
'struct atomic_int' does not help. But this patch fixes the test failures:


2025-11-11  Bruno Haible  <[email protected]>

        pthread-cond, cond, cnd tests: Fix spurious failure on Linux/SPARC.
        Reported by Santiago Vila <[email protected]> in
        <https://lists.gnu.org/archive/html/bug-gettext/2025-11/msg00005.html>.
        * tests/test-pthread-cond.c (test_pthread_cond_timedwait): Sleep for 3
        instead of 2 seconds.
        * tests/test-cond.c (test_timedcond): Likewise.
        * tests/test-cnd.c (test_cnd_timedwait): Likewise.

diff --git a/tests/test-cnd.c b/tests/test-cnd.c
index 7bcf40d098..17a7097c6d 100644
--- a/tests/test-cnd.c
+++ b/tests/test-cnd.c
@@ -197,11 +197,11 @@ test_cnd_timedwait (void)
   ASSERT (thrd_create (&thread, cnd_timedwait_routine, &skipped)
           == thrd_success);
 
-  /* Sleep for 2 seconds.  */
+  /* Sleep for 3 seconds.  */
   {
     struct timespec remaining;
 
-    remaining.tv_sec = 2;
+    remaining.tv_sec = 3;
     remaining.tv_nsec = 0;
 
     do
diff --git a/tests/test-cond.c b/tests/test-cond.c
index ee33592a58..926e985a29 100644
--- a/tests/test-cond.c
+++ b/tests/test-cond.c
@@ -191,9 +191,9 @@ test_timedcond (void)
   /* Create a separate thread.  */
   thread = gl_thread_create (timedcond_routine, &skipped);
 
-  /* Sleep for 2 seconds.  */
+  /* Sleep for 3 seconds.  */
   {
-    int remaining = 2;
+    int remaining = 3;
 
     do
       {
diff --git a/tests/test-pthread-cond.c b/tests/test-pthread-cond.c
index 9a46b01810..e525469793 100644
--- a/tests/test-pthread-cond.c
+++ b/tests/test-pthread-cond.c
@@ -204,11 +204,11 @@ test_pthread_cond_timedwait (void)
                           pthread_cond_timedwait_routine, &skipped)
           == 0);
 
-  /* Sleep for 2 seconds.  */
+  /* Sleep for 3 seconds.  */
   {
     struct timespec remaining;
 
-    remaining.tv_sec = 2;
+    remaining.tv_sec = 3;
     remaining.tv_nsec = 0;
 
     do




Reply via email to