[PATCH 3/7] drm/xe/tests: Convert xe_bo live tests

Michal Wajdeczko michal.wajdeczko at intel.com
Tue Jul 16 21:38:57 UTC 2024


Convert xe_bo live tests to parameterized style.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
---
 drivers/gpu/drm/xe/tests/xe_bo.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/xe/tests/xe_bo.c b/drivers/gpu/drm/xe/tests/xe_bo.c
index 692e1b46b9cf..53bb4686fa73 100644
--- a/drivers/gpu/drm/xe/tests/xe_bo.c
+++ b/drivers/gpu/drm/xe/tests/xe_bo.c
@@ -6,6 +6,7 @@
 #include <kunit/test.h>
 #include <kunit/visibility.h>
 
+#include "tests/xe_kunit_helpers.h"
 #include "tests/xe_pci_test.h"
 #include "tests/xe_test.h"
 
@@ -158,7 +159,7 @@ static int ccs_test_run_device(struct xe_device *xe)
 	int id;
 
 	if (!xe_device_has_flat_ccs(xe)) {
-		kunit_info(test, "Skipping non-flat-ccs device.\n");
+		kunit_skip(test, "Skipping non-flat-ccs device.\n");
 		return 0;
 	}
 
@@ -178,7 +179,9 @@ static int ccs_test_run_device(struct xe_device *xe)
 
 static void xe_ccs_migrate_kunit(struct kunit *test)
 {
-	xe_call_for_each_device(ccs_test_run_device);
+	struct xe_device *xe = test->priv;
+
+	ccs_test_run_device(xe);
 }
 
 static int evict_test_run_tile(struct xe_device *xe, struct xe_tile *tile, struct kunit *test)
@@ -328,7 +331,7 @@ static int evict_test_run_device(struct xe_device *xe)
 	int id;
 
 	if (!IS_DGFX(xe)) {
-		kunit_info(test, "Skipping non-discrete device %s.\n",
+		kunit_skip(test, "Skipping non-discrete device %s.\n",
 			   dev_name(xe->drm.dev));
 		return 0;
 	}
@@ -345,12 +348,14 @@ static int evict_test_run_device(struct xe_device *xe)
 
 static void xe_bo_evict_kunit(struct kunit *test)
 {
-	xe_call_for_each_device(evict_test_run_device);
+	struct xe_device *xe = test->priv;
+
+	evict_test_run_device(xe);
 }
 
 static struct kunit_case xe_bo_tests[] = {
-	KUNIT_CASE(xe_ccs_migrate_kunit),
-	KUNIT_CASE(xe_bo_evict_kunit),
+	KUNIT_CASE_PARAM(xe_ccs_migrate_kunit, xe_pci_live_device_gen_param),
+	KUNIT_CASE_PARAM(xe_bo_evict_kunit, xe_pci_live_device_gen_param),
 	{}
 };
 
@@ -358,5 +363,7 @@ VISIBLE_IF_KUNIT
 struct kunit_suite xe_bo_test_suite = {
 	.name = "xe_bo",
 	.test_cases = xe_bo_tests,
+	.init = xe_kunit_helper_xe_device_live_test_init,
+	.exit = xe_kunit_helper_xe_device_live_test_exit,
 };
 EXPORT_SYMBOL_IF_KUNIT(xe_bo_test_suite);
-- 
2.43.0



More information about the Intel-xe mailing list