summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gmail.com>2020-03-10 16:04:40 +0000
committerEmmanuele Bassi <ebassi@gmail.com>2020-03-10 16:04:40 +0000
commit1ddbbf0c0969e4b35a4a5e86a031bfec80990187 (patch)
treeb8ea588dd853bead611581a23136665f69226c69
parentae96a47cc5f74ac7c035f92a801e6f7132293967 (diff)
parent82a9e86f52333607e9a085ec5e4a8daf5137ab93 (diff)
downloadcogl-1ddbbf0c0969e4b35a4a5e86a031bfec80990187.tar.gz
Merge branch 'wip/smcv/test-timeout' into 'cogl-1.22'
[1.22] Terminate tests with SIGALRM if they take more than 120 seconds See merge request GNOME/cogl!11
-rw-r--r--configure.ac2
-rw-r--r--test-fixtures/test-utils.c9
2 files changed, 11 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 1f0c6060..e3f08131 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1373,6 +1373,8 @@ dnl ================================================================
dnl Checks for library functions.
dnl ================================================================
+AC_CHECK_FUNCS_ONCE([alarm])
+
dnl The 'ffs' function is part of C99 so it isn't always
dnl available. Cogl has a fallback if needed.
dnl
diff --git a/test-fixtures/test-utils.c b/test-fixtures/test-utils.c
index ea9ad76c..7c58a50d 100644
--- a/test-fixtures/test-utils.c
+++ b/test-fixtures/test-utils.c
@@ -2,6 +2,10 @@
#include <stdlib.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
#include "test-unit.h"
#include "test-utils.h"
@@ -146,6 +150,11 @@ test_utils_init (TestFlags requirement_flags,
"$ make test-report");
counter++;
+#ifdef HAVE_ALARM
+ /* Kill the test with SIGALRM if it takes more than this many seconds */
+ alarm (120);
+#endif
+
if (is_boolean_env_set ("COGL_TEST_VERBOSE") ||
is_boolean_env_set ("V"))
cogl_test_is_verbose = TRUE;