In a testdir configured with --disable-threads and in packages
that use gl_DISABLE_THREADS, I see a test failure:

FAIL: test-thread-optim2
========================

FAIL test-thread-optim2 (exit status: 134)

This patch fixes it.


2026-05-18  Bruno Haible  <[email protected]>

        thread-optim tests: Fix a test failure with --disable-threads.
        * tests/test-thread-optim2.c: Skip the test if multithreading is not
        enabled.

diff --git a/tests/test-thread-optim2.c b/tests/test-thread-optim2.c
index bd2e3b2955..5a61b687aa 100644
--- a/tests/test-thread-optim2.c
+++ b/tests/test-thread-optim2.c
@@ -25,6 +25,8 @@
 
 #include "macros.h"
 
+#if USE_ISOC_THREADS || USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS || 
USE_WINDOWS_THREADS
+
 static int dummy;
 
 static void *
@@ -50,3 +52,20 @@ main ()
 
   return test_exit_status;
 }
+
+#else
+
+/* No multithreading available.
+   glthread_create is a dummy that just returns ENOSYS.
+   gl_thread_create therefore aborts.  */
+
+#include <stdio.h>
+
+int
+main ()
+{
+  fputs ("Skipping test: multithreading not enabled\n", stderr);
+  return 77;
+}
+
+#endif




Reply via email to