>From a7903da07d3d18c23314aa0815adbb4058fd7cec Mon Sep 17 00:00:00 2001
From: Jim Meyering
Date: Sun, 5 Jan 2020 10:25:27 -0800
Subject: [PATCH] tests: skip thread-using tests when threading is disabled
sed's configure.ac specifies gl_DISABLE_THREADS, and that caused three
thread-using gnulib tests to fail. Add an #if-guarded exit (77) to each
of those, so they are skipped in this case.
* tests/test-nl_langinfo-mt.c (main): Exit 77 when threading is disabled.
* tests/test-setlocale_null-mt-all.c (main): Likewise.
* tests/test-setlocale_null-mt-one.c (main): Likewise.
---
ChangeLog | 10 ++++++++++
tests/test-nl_langinfo-mt.c | 17 +++++++++++++++++
tests/test-setlocale_null-mt-all.c | 17 +++++++++++++++++
tests/test-setlocale_null-mt-one.c | 17 +++++++++++++++++
4 files changed, 61 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index c8a9dbf..6d5228e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2020-01-05 Jim Meyering
+
+ tests: skip thread-using tests when threading is disabled
+ sed's configure.ac specifies gl_DISABLE_THREADS, and that caused three
+ thread-using gnulib tests to fail. Add an #if-guarded exit (77) to each
+ of those, so they are skipped in this case.
+ * tests/test-nl_langinfo-mt.c (main): Exit 77 when threading is disabled.
+ * tests/test-setlocale_null-mt-all.c (main): Likewise.
+ * tests/test-setlocale_null-mt-one.c (main): Likewise.
+
2020-01-05 Bruno Haible
tests: Avoid GCC over-optimization caused by _GL_ARG_NONNULL attributes.
diff --git a/tests/test-nl_langinfo-mt.c b/tests/test-nl_langinfo-mt.c
index 55f9db9..de6cd99 100644
--- a/tests/test-nl_langinfo-mt.c
+++ b/tests/test-nl_langinfo-mt.c
@@ -18,6 +18,8 @@
#include
+#if USE_ISOC_THREADS || USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS || USE_WINDOWS_THREADS
+
/* Specification. */
#include
@@ -236,3 +238,18 @@ main (int argc, char *argv[])
return 0;
}
+
+#else
+
+/* No multithreading available. */
+
+#include
+
+int
+main ()
+{
+ fputs ("Skipping test: multithreading not enabled\n", stderr);
+ return 77;
+}
+
+#endif
diff --git a/tests/test-setlocale_null-mt-all.c b/tests/test-setlocale_null-mt-all.c
index a4f91d9..19bdb55 100644
--- a/tests/test-setlocale_null-mt-all.c
+++ b/tests/test-setlocale_null-mt-all.c
@@ -18,6 +18,8 @@
#include
+#if USE_ISOC_THREADS || USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS || USE_WINDOWS_THREADS
+
/* Specification. */
#include
@@ -131,6 +133,21 @@ main (int argc, char *argv[])
return 0;
}
+#else
+
+/* No multithreading available. */
+
+#include
+
+int
+main ()
+{
+ fputs ("Skipping test: multithreading not enabled\n", stderr);
+ return 77;
+}
+
+#endif
+
/* Without locking, the results of this test would be:
glibc OK
musl libc crash < 10 sec
diff --git a/tests/test-setlocale_null-mt-one.c b/tests/test-setlocale_null-mt-one.c
index dc9d4aa..fd6083a 100644
--- a/tests/test-setlocale_null-mt-one.c
+++ b/tests/test-setlocale_null-mt-one.c
@@ -18,6 +18,8 @@
#include
+#if USE_ISOC_THREADS || USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS || USE_WINDOWS_THREADS
+
/* Specification. */
#include
@@ -131,6 +133,21 @@ main (int argc, char *argv[])
return 0;
}
+#else
+
+/* No multithreading available. */
+
+#include
+
+int
+main ()
+{
+ fputs ("Skipping test: multithreading not enabled\n", stderr);
+ return 77;
+}
+
+#endif
+
/* Without locking, the results of this test would be:
glibc OK
musl libc OK
--
2.7.4