]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
thread-optim tests: Fix a test failure with --disable-threads.
authorBruno Haible <bruno@clisp.org>
Mon, 18 May 2026 19:21:34 +0000 (21:21 +0200)
committerBruno Haible <bruno@clisp.org>
Mon, 18 May 2026 19:21:34 +0000 (21:21 +0200)
* tests/test-thread-optim2.c: Skip the test if multithreading is not
enabled.

ChangeLog
tests/test-thread-optim2.c

index 6ec8724e199098f656f6ba39f19d4122266a9ba8..10277133f5865863e9fe6bae232ce3384bb87907 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2026-05-18  Bruno Haible  <bruno@clisp.org>
+
+       thread-optim tests: Fix a test failure with --disable-threads.
+       * tests/test-thread-optim2.c: Skip the test if multithreading is not
+       enabled.
+
 2026-05-18  Bruno Haible  <bruno@clisp.org>
 
        term-style-control: Make multithread-safe, part 5: SIGCONT handler.
index bd2e3b2955a3459684106da941492733e7097d95..5a61b687aa59d7e2acd4e587751120480a8d19c6 100644 (file)
@@ -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