[igt-dev] [PATCH i-g-t 1/3] xe/xe_mmap: Negative test for mmap flags
priyanka.dandamudi at intel.com
priyanka.dandamudi at intel.com
Fri May 26 05:08:53 UTC 2023
From: Priyanka Dandamudi <priyanka.dandamudi at intel.com>
Add negative test by adding invalid mmap flags and check
for related errors.
v2: Add default alignment for the object size.(Zbigniew)
Cc: Janga Rahul Kumar <janga.rahul.kumar at intel.com>
Cc: Kamil Konieczny <kamil.konieczny at linux.intel.com>
Cc: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
Signed-off-by: Priyanka Dandamudi <priyanka.dandamudi at intel.com>
---
tests/xe/xe_mmap.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/tests/xe/xe_mmap.c b/tests/xe/xe_mmap.c
index 6b313a18..3e3f165b 100644
--- a/tests/xe/xe_mmap.c
+++ b/tests/xe/xe_mmap.c
@@ -57,6 +57,23 @@ test_mmap(int fd, uint32_t flags)
gem_close(fd, bo);
}
+/**
+ * SUBTEST: bad-flags
+ * Description: Test mmap offset with bad flags.
+ *
+ */
+static void test_bad_flags(int fd)
+{
+ uint64_t size = xe_get_default_alignment(fd);
+ struct drm_xe_gem_mmap_offset mmo = {
+ .handle = xe_bo_create(fd, 0, 0, size),
+ .flags = -1u,
+ };
+
+ do_ioctl_err(fd, DRM_IOCTL_XE_GEM_MMAP_OFFSET, &mmo, EINVAL);
+ gem_close(fd, mmo.handle);
+}
+
igt_main
{
int fd;
@@ -75,6 +92,9 @@ igt_main
igt_subtest("vram-system")
test_mmap(fd, vram_memory(fd, 0) | system_memory(fd));
+ igt_subtest("bad-flags")
+ test_bad_flags(fd);
+
igt_fixture {
xe_device_put(fd);
close(fd);
--
2.25.1
More information about the igt-dev
mailing list