summaryrefslogtreecommitdiff
path: root/tests/gem_eio.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2017-09-08 13:48:05 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2017-09-11 12:06:51 +0100
commit4f082c35d2df545f81d202ae1a08463f6c123552 (patch)
tree16b4a53dfeb8c178f0fcb254303d5f0f3ad7ea96 /tests/gem_eio.c
parent20631542ebb3f32c9d00ba0c251e08e54a73f1fd (diff)
igt/gem_eio: Install an exithandler to unwedge the device after failure
Under normal conditions, we try to repair the damage we inflict to the GPU, but if we fail we don't. Make sure that if the test does die, we do try to restore normal operation by using an atexit handler. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102616 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Diffstat (limited to 'tests/gem_eio.c')
-rw-r--r--tests/gem_eio.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/tests/gem_eio.c b/tests/gem_eio.c
index 15120842..207a9ef9 100644
--- a/tests/gem_eio.c
+++ b/tests/gem_eio.c
@@ -220,14 +220,27 @@ static void test_inflight(int fd)
trigger_reset(fd);
}
+static int fd = -1;
+
+static void
+exit_handler(int sig)
+{
+ i915_reset_control(true);
+ igt_force_gpu_reset(fd);
+}
+
igt_main
{
- int fd = -1;
igt_skip_on_simulation();
igt_fixture {
fd = drm_open_driver(DRIVER_INTEL);
+
+ igt_require(i915_reset_control(true));
+ igt_force_gpu_reset(fd);
+ igt_install_exit_handler(exit_handler);
+
igt_require_gem(fd);
igt_require_hang_ring(fd, I915_EXEC_DEFAULT);
}
@@ -243,7 +256,4 @@ igt_main
igt_subtest("in-flight")
test_inflight(fd);
-
- igt_fixture
- close(fd);
}