summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-02-26 22:11:10 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2016-02-26 22:19:41 +0000
commit754876378d6c9b2775e8c07b4d16f9878c55949f (patch)
tree3b71e329c42d2bc83768ee8e0b2f516724130e45 /lib
parent3482925454da8c107f720448d24789ce6bf884c4 (diff)
igt/gem_sync: Enforce a timeout of 20s
The sync test is supposed to complete in 10s. But some bugs cause it to run very, very slowly. As a defence against those, terminate the test if we wait for more than 20s. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_core.c17
-rw-r--r--lib/igt_core.h1
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/igt_core.c b/lib/igt_core.c
index 8e0bd2e8..5bbf13b5 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -1131,6 +1131,9 @@ void igt_exit(void)
kmsg(KERN_INFO "%s: exiting, ret=%d\n", command_str, igt_exitcode);
igt_debug("Exiting with status code %d\n", igt_exitcode);
+ for (int c = 0; c < num_test_children; c++)
+ kill(test_children[c], SIGKILL);
+
if (!test_with_subtests) {
struct timespec now;
const char *result;
@@ -1401,6 +1404,20 @@ void igt_waitchildren(void)
igt_fail(err);
}
+/**
+ * igt_waitchildren_timeout:
+ *
+ * Wait for all children forked with igt_fork, for a maximum of @seconds.
+ *
+ * Wraps igt_waitchildren() and igt_set_timeout()
+ */
+void igt_waitchildren_timeout(int seconds, const char *reason)
+{
+ igt_set_timeout(seconds, reason);
+ igt_waitchildren();
+ igt_reset_timeout();
+}
+
/* exit handler code */
#define MAX_SIGNALS 32
#define MAX_EXIT_HANDLERS 10
diff --git a/lib/igt_core.h b/lib/igt_core.h
index 8f297e06..9d4c9636 100644
--- a/lib/igt_core.h
+++ b/lib/igt_core.h
@@ -610,6 +610,7 @@ bool __igt_fork(void);
for (int child = 0; child < (num_children); child++) \
for (; __igt_fork(); exit(0))
void igt_waitchildren(void);
+void igt_waitchildren_timeout(int seconds, const char *reason);
/**
* igt_helper_process: