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>
This commit is contained in:
Chris Wilson 2015-07-15 16:18:10 +01:00
parent 7f952bd976
commit 32c898849b

View File

@ -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);
}