* tests/test-tls.c: Include <signal.h>, <unistd.h>.
(main): Let the test fail if it takes more than 10 minutes.
* modules/tls-tests (configure.ac): Test whether 'alarm' is declared.
+2019-04-28 Bruno Haible <bruno@clisp.org>
+
+ tls tests: Prevent that the test takes too long.
+ * tests/test-tls.c: Include <signal.h>, <unistd.h>.
+ (main): Let the test fail if it takes more than 10 minutes.
+ * modules/tls-tests (configure.ac): Test whether 'alarm' is declared.
+
2019-04-27 Bruno Haible <bruno@clisp.org>
lock tests: Prevent that the test takes too long.
yield
configure.ac:
+AC_CHECK_DECLS_ONCE([alarm])
Makefile.am:
TESTS += test-tls
#include "glthread/thread.h"
#include "glthread/yield.h"
+#if HAVE_DECL_ALARM
+# include <signal.h>
+# include <unistd.h>
+#endif
+
#if ENABLE_DEBUGGING
# define dbgprintf printf
#else
int
main ()
{
+#if HAVE_DECL_ALARM
+ /* Declare failure if test takes too long, by using default abort
+ caused by SIGALRM. */
+ int alarm_value = 600;
+ signal (SIGALRM, SIG_DFL);
+ alarm (alarm_value);
+#endif
+
#if TEST_PTH_THREADS
if (!pth_init ())
abort ();