* tests/test-lock.c: Include <signal.h>, <unistd.h>.
(main): Let the test fail if it takes more than 10 minutes.
* modules/lock-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.
+ * tests/test-lock.c: Include <signal.h>, <unistd.h>.
+ (main): Let the test fail if it takes more than 10 minutes.
+ * modules/lock-tests (configure.ac): Test whether 'alarm' is declared.
+
2019-04-27 Bruno Haible <bruno@clisp.org>
localename: Fix crash on mingw (regression from 2018-11-23).
configure.ac:
AC_CHECK_HEADERS_ONCE([semaphore.h])
+AC_CHECK_DECLS_ONCE([alarm])
Makefile.am:
TESTS += test-rwlock1 test-lock test-once1 test-once2
# include <unistd.h>
#endif
+#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 ();