diff options
author | Simon McVittie <smcv@debian.org> | 2019-08-24 15:48:46 +0100 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2019-08-25 18:07:05 +0100 |
commit | d169caeaa7c542d68a4fefe88e76e7a2628402cf (patch) | |
tree | 65c44f9f5ec0870b6ece82c79e04127b78db4a24 | |
parent | aed28f918bac9ec09bfc07a30d41589d03e79d86 (diff) |
Terminate tests with SIGALRM if they take more than 120 seconds
We're currently ignoring test failures, but if a test hangs, that will
still cause the build to fail (and tie up a buildd for 150 minutes).
The fork of cogl in Mutter uses a 120 second timeout for tests in its
Meson build system, but other than that it's purely an arbitrary number.
Bug-Debian: https://bugs.debian.org/935592
Forwarded: no
Gbp-Pq: Name Terminate-tests-with-SIGALRM-if-they-take-more-than-120-s.patch
-rw-r--r-- | test-fixtures/test-utils.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test-fixtures/test-utils.c b/test-fixtures/test-utils.c index 59e3fd8c..b1ef12b9 100644 --- a/test-fixtures/test-utils.c +++ b/test-fixtures/test-utils.c @@ -1,6 +1,7 @@ #include <config.h> #include <stdlib.h> +#include <unistd.h> #include "test-unit.h" #include "test-utils.h" @@ -146,6 +147,9 @@ test_utils_init (TestFlags requirement_flags, "$ make test-report"); counter++; + /* Kill the test with SIGALRM if it takes more than this many seconds */ + alarm (120); + if (is_boolean_env_set ("COGL_TEST_VERBOSE") || is_boolean_env_set ("V")) cogl_test_is_verbose = TRUE; |