[igt-dev] [PATCH] tests/xe/xe_create: Exercise oversized object detection

priyanka.dandamudi at intel.com priyanka.dandamudi at intel.com
Wed May 10 06:54:15 UTC 2023


From: Priyanka Dandamudi <priyanka.dandamudi at intel.com>

Create an oversized object and try to check if it throws an error.

v2: Added it as a new subtest.(Rahul)

Cc: Janga Rahul Kumar <janga.rahul.kumar at intel.com>
Signed-off-by: Priyanka Dandamudi <priyanka.dandamudi at intel.com>
Acked-by: Janga Rahul Kumar <janga.rahul.kumar at intel.com>
---
 tests/xe/xe_create.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/tests/xe/xe_create.c b/tests/xe/xe_create.c
index ae841f80..5effabc8 100644
--- a/tests/xe/xe_create.c
+++ b/tests/xe/xe_create.c
@@ -87,6 +87,26 @@ static void create_invalid_size(int fd)
 	xe_vm_destroy(fd, vm);
 }
 
+/**
+ * SUBTEST: create-massive-size
+ * Description: Verifies xe bo create returns expected error code on massive
+ *              buffer sizes.
+ */
+static void create_massive_size(int fd)
+{
+	uint64_t memreg = all_memory_regions(fd), region;
+	uint32_t vm;
+	uint32_t handle;
+	int ret;
+
+	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_ASYNC_BIND_OPS, 0);
+
+	xe_for_each_mem_region(fd, memreg, region) {
+		ret = __create_bo(fd, vm, -1ULL >> 32, region, &handle);
+		igt_assert_eq(ret, -ENOSPC);
+	}
+}
+
 igt_main
 {
 	int xe;
@@ -100,6 +120,11 @@ igt_main
 		create_invalid_size(xe);
 	}
 
+	igt_subtest("create-massive-size") {
+		create_massive_size(xe);
+	}
+
+
 	igt_fixture {
 		xe_device_put(xe);
 		close(xe);
-- 
2.25.1



More information about the igt-dev mailing list