[igt-dev] [PATCH i-g-t 2/2] tests/xe_vm.c: Add Negative test to VM error capture

janga.rahul.kumar at intel.com janga.rahul.kumar at intel.com
Wed Jun 7 08:03:52 UTC 2023


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

Add negative test to check invalid arguments.

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

diff --git a/tests/xe/xe_vm.c b/tests/xe/xe_vm.c
index 0da6c847..7f369fc4 100644
--- a/tests/xe/xe_vm.c
+++ b/tests/xe/xe_vm.c
@@ -1638,6 +1638,31 @@ vm_error_capture_address(int fd)
 	xe_vm_destroy(fd, vm);
 }
 
+/**
+ * SUBTEST: vm-error-capture-address-invalid-val
+ * Description: Negative test to check vm error capture
+ * Functionality: error capture
+ * Run type: FULL
+ * TODO: change ``'Run type' == FULL`` to a better category
+ *
+ */
+static void
+vm_error_capture_address_invalid_val(int fd)
+{
+	struct drm_xe_ext_vm_set_property ext = {
+		.base.next_extension = 0,
+		.base.name = XE_VM_EXTENSION_SET_PROPERTY,
+		.property = XE_VM_PROPERTY_BIND_OP_ERROR_CAPTURE_ADDRESS,
+		.value = 0,
+	};
+
+	struct drm_xe_vm_create create = {
+		.extensions = to_user_pointer(&ext),
+		.flags = DRM_XE_VM_CREATE_ASYNC_BIND_OPS,
+	};
+
+	do_ioctl_err(fd, DRM_IOCTL_XE_VM_CREATE, &create, EINVAL);
+}
 
 igt_main
 {
@@ -1924,6 +1949,9 @@ igt_main
 	igt_subtest("vm-error-capture-address")
 		vm_error_capture_address(fd);
 
+	igt_subtest("vm-error-capture-address-invalid-val")
+		vm_error_capture_address_invalid_val(fd);
+
 	igt_fixture {
 		xe_device_put(fd);
 		close(fd);
-- 
2.25.1



More information about the igt-dev mailing list