summaryrefslogtreecommitdiff
path: root/tests/i915
diff options
context:
space:
mode:
authorAntonio Argenziano <antonio.argenziano@intel.com>2019-03-13 16:27:19 -0700
committerChris Wilson <chris@chris-wilson.co.uk>2019-03-19 17:05:44 +0000
commit212f34d27085085446ed7adfcc7fe9172f89df89 (patch)
tree780076a9247479c63f07f772e8b133282040a867 /tests/i915
parente3faf0fd49b7e3a763bf89e11fb4fdce81839da2 (diff)
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 <antonio.argenziano@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests/i915')
-rw-r--r--tests/i915/gem_mmap_gtt.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/i915/gem_mmap_gtt.c b/tests/i915/gem_mmap_gtt.c
index f6fbbe19..8d304808 100644
--- a/tests/i915/gem_mmap_gtt.c
+++ b/tests/i915/gem_mmap_gtt.c
@@ -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")