The CI reports a 'test-pthread-rwlock-waitqueue' failure also on the macOS
machines. The first patch attempts to avoid this failure.

But it means that the test needs 30 seconds on some more machines. So, some
packages might want to avoid it. To make this easy, I'm moving it to a
separate module.


2024-08-12  Bruno Haible  <br...@clisp.org>

        pthread-rwlock tests: Move the waitqueue test into a separate module.
        * modules/pthread-rwlock-extra-tests: New file.
        * modules/pthread-rwlock-tests: Revert 2024-08-07 changes.
        (Depends-on): Add pthread-rwlock-extra-tests.

2024-08-12  Bruno Haible  <br...@clisp.org>

        pthread-rwlock: Attempt to avoid test failure on some more machines.
        * tests/test-pthread-rwlock-waitqueue.c (STEP_INTERVAL): Bump the
        minimum interval to 20 ms on macOS.

>From ef4c430e2d012bf2edaa13f28fd0042169845222 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Mon, 12 Aug 2024 11:15:37 +0200
Subject: [PATCH 1/2] pthread-rwlock: Attempt to avoid test failure on some
 more machines.

* tests/test-pthread-rwlock-waitqueue.c (STEP_INTERVAL): Bump the
minimum interval to 20 ms on macOS.
---
 ChangeLog                             | 6 ++++++
 tests/test-pthread-rwlock-waitqueue.c | 4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4cc404508a..43f32c4fca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-08-12  Bruno Haible  <br...@clisp.org>
+
+	pthread-rwlock: Attempt to avoid test failure on some more machines.
+	* tests/test-pthread-rwlock-waitqueue.c (STEP_INTERVAL): Bump the
+	minimum interval to 20 ms on macOS.
+
 2024-08-11  Collin Funk  <collin.fu...@gmail.com>
 
 	htonl: Fix link errors on Windows.
diff --git a/tests/test-pthread-rwlock-waitqueue.c b/tests/test-pthread-rwlock-waitqueue.c
index b7df033c90..bfe5770463 100644
--- a/tests/test-pthread-rwlock-waitqueue.c
+++ b/tests/test-pthread-rwlock-waitqueue.c
@@ -52,8 +52,8 @@
 #if defined _WIN32 || defined __CYGWIN__
 /* Windows */
 # define STEP_INTERVAL 50000000 /* nanoseconds */
-#elif (defined __FreeBSD__ || defined __DragonFly__) || (defined __linux__ && defined __hppa)
-/* FreeBSD, Linux/hppa */
+#elif (defined __APPLE__ && defined __MACH__) || (defined __FreeBSD__ || defined __DragonFly__) || (defined __linux__ && defined __hppa)
+/* macOS, FreeBSD, Linux/hppa */
 # define STEP_INTERVAL 20000000 /* nanoseconds */
 #else
 # define STEP_INTERVAL 10000000 /* nanoseconds */
-- 
2.34.1

>From 6fc3ac8f94a6172bf92640a9def08600a379f660 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Mon, 12 Aug 2024 11:24:40 +0200
Subject: [PATCH 2/2] pthread-rwlock tests: Move the waitqueue test into a
 separate module.

* modules/pthread-rwlock-extra-tests: New file.
* modules/pthread-rwlock-tests: Revert 2024-08-07 changes.
(Depends-on): Add pthread-rwlock-extra-tests.
---
 ChangeLog                          |  7 +++++++
 modules/pthread-rwlock-extra-tests | 16 ++++++++++++++++
 modules/pthread-rwlock-tests       | 10 +++-------
 3 files changed, 26 insertions(+), 7 deletions(-)
 create mode 100644 modules/pthread-rwlock-extra-tests

diff --git a/ChangeLog b/ChangeLog
index 43f32c4fca..7533e2f5b7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-08-12  Bruno Haible  <br...@clisp.org>
+
+	pthread-rwlock tests: Move the waitqueue test into a separate module.
+	* modules/pthread-rwlock-extra-tests: New file.
+	* modules/pthread-rwlock-tests: Revert 2024-08-07 changes.
+	(Depends-on): Add pthread-rwlock-extra-tests.
+
 2024-08-12  Bruno Haible  <br...@clisp.org>
 
 	pthread-rwlock: Attempt to avoid test failure on some more machines.
diff --git a/modules/pthread-rwlock-extra-tests b/modules/pthread-rwlock-extra-tests
new file mode 100644
index 0000000000..c14e3ed8ac
--- /dev/null
+++ b/modules/pthread-rwlock-extra-tests
@@ -0,0 +1,16 @@
+Files:
+tests/test-pthread-rwlock-waitqueue.c
+tests/macros.h
+
+Depends-on:
+extensions
+pthread-thread
+nanosleep
+stdbool
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-pthread-rwlock-waitqueue
+check_PROGRAMS += test-pthread-rwlock-waitqueue
+test_pthread_rwlock_waitqueue_LDADD = $(LDADD) @LIBPMULTITHREAD@ @NANOSLEEP_LIB@
diff --git a/modules/pthread-rwlock-tests b/modules/pthread-rwlock-tests
index cf52ec4d33..2ae848b1ef 100644
--- a/modules/pthread-rwlock-tests
+++ b/modules/pthread-rwlock-tests
@@ -1,18 +1,15 @@
 Files:
 tests/test-pthread-rwlock.c
-tests/test-pthread-rwlock-waitqueue.c
 tests/atomic-int-posix.h
 tests/macros.h
 m4/semaphore.m4
 
 Depends-on:
-extensions
 pthread-thread
 pthread-mutex
 sched_yield
 random
-nanosleep
-stdbool
+pthread-rwlock-extra-tests
 
 configure.ac:
 AC_CHECK_HEADERS_ONCE([semaphore.h])
@@ -20,7 +17,6 @@ AC_CHECK_DECLS_ONCE([alarm])
 AC_REQUIRE([gl_SEMAPHORE])
 
 Makefile.am:
-TESTS += test-pthread-rwlock test-pthread-rwlock-waitqueue
-check_PROGRAMS += test-pthread-rwlock test-pthread-rwlock-waitqueue
+TESTS += test-pthread-rwlock
+check_PROGRAMS += test-pthread-rwlock
 test_pthread_rwlock_LDADD = $(LDADD) @LIBPMULTITHREAD@ @SCHED_YIELD_LIB@ @LIB_SEMAPHORE@
-test_pthread_rwlock_waitqueue_LDADD = $(LDADD) @LIBPMULTITHREAD@ @NANOSLEEP_LIB@
-- 
2.34.1

Reply via email to