Commit 212f34d2 authored by Antonio Argenziano's avatar Antonio Argenziano Committed by Chris Wilson

tests/i915/gem_mmap_gtt: Add invalid parameters test

Add a test for an invalid handle being passed to the IOCTL.

v2:
	- Expand test space. (Chris)
Signed-off-by: Antonio Argenziano's avatarAntonio Argenziano <antonio.argenziano@intel.com>
Reviewed-by: Chris Wilson's avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson's avatarChris Wilson <chris@chris-wilson.co.uk>
parent e3faf0fd
......@@ -821,6 +821,17 @@ run_without_prefault(int fd,
igt_enable_prefault();
}
static int mmap_ioctl(int i915, struct drm_i915_gem_mmap_gtt *arg)
{
int err = 0;
if (igt_ioctl(i915, DRM_IOCTL_I915_GEM_MMAP_GTT, arg))
err = -errno;
errno = 0;
return err;
}
int fd;
igt_main
......@@ -831,6 +842,26 @@ igt_main
igt_fixture
fd = drm_open_driver(DRIVER_INTEL);
igt_subtest("bad-object") {
uint32_t real_handle = gem_create(fd, 4096);
uint32_t handles[20];
int i = 0;
handles[i++] = 0xdeadbeef;
for(int bit = 0; bit < 16; bit++)
handles[i++] = real_handle | (1 << (bit + 16));
handles[i] = real_handle + 1;
for (; i < 0; i--) {
struct drm_i915_gem_mmap_gtt arg = {
.handle = handles[i],
};
igt_assert_eq(mmap_ioctl(fd, &arg), -ENOENT);
}
gem_close(fd, real_handle);
}
igt_subtest("basic")
test_access(fd);
igt_subtest("basic-short")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment