[igt-dev] [PATCH i-g-t 2/3] tests/intel/xe_waitfence: Add invalid-ops subtest

janga.rahul.kumar at intel.com janga.rahul.kumar at intel.com
Wed Nov 8 09:16:28 UTC 2023


From: Janga Rahul Kumar <janga.rahul.kumar at intel.com>

Negative test to check ioctl returns expected error when
invalid ops param is used.

Signed-off-by: Janga Rahul Kumar <janga.rahul.kumar at intel.com>
---
 tests/intel/xe_waitfence.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/tests/intel/xe_waitfence.c b/tests/intel/xe_waitfence.c
index 32ffc6eca..87e7b2284 100644
--- a/tests/intel/xe_waitfence.c
+++ b/tests/intel/xe_waitfence.c
@@ -108,6 +108,9 @@ waitfence(int fd, enum waittype wt)
  *
  * SUBTEST: invalid-flag
  * Description: Check query with invalid flag returns expected error code
+ *
+ * SUBTEST: invalid-ops
+ * Description: Check query with invalid engine info returns expected error code
  */
 
 static void
@@ -135,6 +138,32 @@ invalid_flag(int fd)
 	do_ioctl_err(fd, DRM_IOCTL_XE_WAIT_USER_FENCE, &wait, EINVAL);
 }
 
+static void
+invalid_ops(int fd)
+{
+	uint32_t bo;
+
+	struct drm_xe_wait_user_fence wait = {
+		.addr = to_user_pointer(&wait_fence),
+		.op = -1,
+		.flags = 0,
+		.value = 1,
+		.mask = DRM_XE_UFENCE_WAIT_U64,
+		.timeout = 1,
+		.num_engines = 0,
+		.instances = 0,
+	};
+
+	uint32_t vm = xe_vm_create(fd, DRM_XE_VM_CREATE_ASYNC_DEFAULT, 0);
+
+	bo = xe_bo_create_flags(fd, vm, 0x40000, MY_FLAG);
+
+	do_bind(fd, vm, bo, 0, 0x200000, 0x40000, 1);
+
+	do_ioctl_err(fd, DRM_IOCTL_XE_WAIT_USER_FENCE, &wait, EINVAL);
+}
+
+
 igt_main
 {
 	int fd;
@@ -151,6 +180,9 @@ igt_main
 	igt_subtest("invalid-flag")
 		invalid_flag(fd);
 
+	igt_subtest("invalid-ops")
+		invalid_ops(fd);
+
 	igt_fixture
 		drm_close_driver(fd);
 }
-- 
2.25.1



More information about the igt-dev mailing list