summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2015-07-15 16:18:10 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2015-07-15 22:09:54 +0100
commit32c898849bd4f087e5b816b6e9e842edd5ce81d6 (patch)
treebabe2597009f8b9fe2dba3b9b18f1ede6c8ffd66
parent7f952bd976416196f628c42a8d7bf77fe3c1540f (diff)
igt/gem_eio: Waiting on a hung batch should report -EIO
If we are waiting on a handle, and its request is cancelled due to a hang, we should report that explicitly through the ABI. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--tests/gem_eio.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/tests/gem_eio.c b/tests/gem_eio.c
index 6d60d465..998766c1 100644
--- a/tests/gem_eio.c
+++ b/tests/gem_eio.c
@@ -147,9 +147,34 @@ static void test_execbuf(int fd)
trigger_reset(fd);
}
+static int __gem_wait(int fd, uint32_t handle, int64_t timeout)
+{
+ struct drm_i915_gem_wait wait;
+ int err = 0;
+
+ memset(&wait, 0, sizeof(wait));
+ wait.bo_handle = handle;
+ wait.timeout_ns = timeout;
+ if (drmIoctl(fd, DRM_IOCTL_I915_GEM_WAIT, &wait))
+ err = -errno;
+
+ return err;
+}
+
+static void test_wait(int fd)
+{
+ igt_hang_ring_t hang;
+
+ hang = igt_hang_ring(fd, I915_EXEC_DEFAULT);
+ igt_assert_eq(__gem_wait(fd, hang.handle, -1), -EIO);
+ igt_post_hang_ring(fd, hang);
+
+ trigger_reset(fd);
+}
+
igt_main
{
- int fd;
+ int fd = -1;
igt_skip_on_simulation();
@@ -164,6 +189,9 @@ igt_main
igt_subtest("execbuf")
test_execbuf(fd);
+ igt_subtest("wait")
+ test_wait(fd);
+
igt_fixture
close(fd);
}