summaryrefslogtreecommitdiff
path: root/lib/igt_aux.h
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-03-19 13:04:02 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2016-03-19 15:20:43 +0000
commitd54561086189d3bc83403d0ae19a389d0a68f89d (patch)
tree7c37fe96a0e718abba651d2fd9a50e6c765c9247 /lib/igt_aux.h
parentc1fed522ae98b7c74700521f7b3e0368f0f0948e (diff)
lib/igt_aux: Divert ioctls for signal injection
To simplify and speed up running interruptible tests, use a custom ioctl() function that control the signaling and detect when we need no more iterations to trigger an interruption. We use a realtime timer to inject the signal after a certain delay, increasing the delay on every loop to try and exercise different code paths within the function. The first delay is very short such that we hopefully enter the kernel with a pending signal. Clients should use struct igt_sigiter iter = {}; while (igt_sigiter_repeat(&iter, enable_interrupts=true)) do_test() to automatically repeat the test until we can inject no more signals into the ioctls. This is condensed into a macro igt_interruptible(enable_interrupts=true) do_test(); for convenience. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/igt_aux.h')
-rw-r--r--lib/igt_aux.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/igt_aux.h b/lib/igt_aux.h
index 427719ef..eabeefd2 100644
--- a/lib/igt_aux.h
+++ b/lib/igt_aux.h
@@ -40,6 +40,14 @@ extern int num_trash_bos;
void igt_fork_signal_helper(void);
void igt_stop_signal_helper(void);
+struct igt_sigiter {
+ unsigned pass;
+};
+
+bool igt_sigiter_continue(struct igt_sigiter *iter, bool interrupt);
+#define igt_interruptible(E) \
+ for (struct igt_sigiter iter__={}; igt_sigiter_continue(&iter__, (E)); )
+
void igt_exchange_int(void *array, unsigned i, unsigned j);
void igt_permute_array(void *array, unsigned size,
void (*exchange_func)(void *array,