[igt-dev] [PATCH i-g-t v2 1/3] tests/i915/gem_mmap_gtt: Add invalid parameters test
Antonio Argenziano
antonio.argenziano at intel.com
Wed Mar 13 23:27:19 UTC 2019
Add a test for an invalid handle being passed to the IOCTL.
v2:
- Expand test space. (Chris)
Signed-off-by: Antonio Argenziano <antonio.argenziano at intel.com>
---
tests/i915/gem_mmap_gtt.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/tests/i915/gem_mmap_gtt.c b/tests/i915/gem_mmap_gtt.c
index f6fbbe19..2d6c6278 100644
--- a/tests/i915/gem_mmap_gtt.c
+++ b/tests/i915/gem_mmap_gtt.c
@@ -831,6 +831,29 @@ igt_main
igt_fixture
fd = drm_open_driver(DRIVER_INTEL);
+ igt_subtest("bad-object") {
+ struct drm_i915_gem_mmap arg;
+ int ret;
+
+ 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--) {
+ memset(&arg, 0, sizeof(arg));
+ arg.handle = handles[i];
+ arg.offset = 0;
+ arg.size = 4096;
+ ret = ioctl(fd, DRM_IOCTL_I915_GEM_MMAP_GTT, &arg);
+ igt_assert(ret == -1 && errno == ENOENT);
+ }
+ }
+
igt_subtest("basic")
test_access(fd);
igt_subtest("basic-short")
--
2.20.1
More information about the igt-dev
mailing list