From: Jim Meyering Date: Sun, 5 Jan 2020 18:25:27 +0000 (-0800) Subject: tests: skip thread-using tests when threading is disabled X-Git-Tag: v1.0~4362 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a7903da07d3d18c23314aa0815adbb4058fd7cec;p=thirdparty%2Fgnulib.git 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. --- diff --git a/ChangeLog b/ChangeLog index c8a9dbfac8..6d5228ed07 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 55f9db98ce..de6cd998b7 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 a4f91d9846..19bdb55de6 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 dc9d4aa794..fd6083a58d 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