[igt-dev] [RFC 2/4] tests/i915/gem_mmap: Add invalid parameters tests

Antonio Argenziano antonio.argenziano at intel.com
Tue Mar 12 21:57:36 UTC 2019


Add a couple of tests that supply invalid parameters to the mmap IOCTL.

Signed-off-by: Antonio Argenziano <antonio.argenziano at intel.com>
---
 tests/i915/gem_mmap.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/tests/i915/gem_mmap.c b/tests/i915/gem_mmap.c
index 0ed15878..2a676b9a 100644
--- a/tests/i915/gem_mmap.c
+++ b/tests/i915/gem_mmap.c
@@ -136,6 +136,24 @@ igt_main
 		igt_assert(ret == -1 && errno == ENOENT);
 	}
 
+	igt_subtest("bad-offset") {
+		memset(&arg, 0, sizeof(arg));
+		arg.handle = gem_create(fd, 4096);
+		arg.offset = 4096 + 1;
+		arg.size = 4096;
+		ret = ioctl(fd, DRM_IOCTL_I915_GEM_MMAP, &arg);
+		igt_assert(ret == -1 && errno == EINVAL);
+	}
+
+	igt_subtest("bad-size") {
+		memset(&arg, 0, sizeof(arg));
+		arg.handle = gem_create(fd, 4096);
+		arg.offset = 4096;
+		arg.size = 0;
+		ret = ioctl(fd, DRM_IOCTL_I915_GEM_MMAP, &arg);
+		igt_assert(ret == -1 && errno == EINVAL);
+	}
+
 	igt_subtest("basic") {
 		arg.handle = gem_create(fd, OBJECT_SIZE);
 		arg.offset = 0;
-- 
2.20.1



More information about the igt-dev mailing list