[PATCH 4/4] drm/xe/kunit: Simplify xe_mocs live tests code layout
Kumar, Janga Rahul
janga.rahul.kumar at intel.com
Wed Jul 10 20:03:10 UTC 2024
> -----Original Message-----
> From: De Marchi, Lucas <lucas.demarchi at intel.com>
> Sent: Tuesday, July 9, 2024 8:22 PM
> To: Wajdeczko, Michal <Michal.Wajdeczko at intel.com>
> Cc: intel-xe at lists.freedesktop.org; Kumar, Janga Rahul
> <janga.rahul.kumar at intel.com>; Roper, Matthew D
> <matthew.d.roper at intel.com>
> Subject: Re: [PATCH 4/4] drm/xe/kunit: Simplify xe_mocs live tests code layout
>
> On Mon, Jul 08, 2024 at 01:12:10PM GMT, Michal Wajdeczko wrote:
> >The test case logic is implemented by the functions compiled as part of
> >the core Xe driver module and then exported to build and register the
> >test suite in the live test module.
> >
> >But we don't need to export individual test case functions, we may just
> >export the entire test suite. And we don't need to register this test
> >suite in a separate file, it can be done in the main file of the live
> >test module.
> >
> >Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
>
> +Matt Roper, +Janga
>
> We ended up implementing the mocs tests on the igt side that can test
> additional things like keeping the values across reset. Is there any additional
> value in keeping the kunit live version?
Mocs Reset IGT tests are not yet added. I will be working to add those igt tests.
Once added will remove these live tests. Till then we need these tests to be running.
Thanks,
Rahul
>
> Lucas De Marchi
>
> >---
> > drivers/gpu/drm/xe/tests/Makefile | 3 +--
> > drivers/gpu/drm/xe/tests/xe_live_test_mod.c | 2 ++
> > drivers/gpu/drm/xe/tests/xe_mocs.c | 20 +++++++++++++++-----
> > drivers/gpu/drm/xe/tests/xe_mocs_test.c | 21 ---------------------
> > drivers/gpu/drm/xe/tests/xe_mocs_test.h | 14 --------------
> > 5 files changed, 18 insertions(+), 42 deletions(-) delete mode 100644
> >drivers/gpu/drm/xe/tests/xe_mocs_test.c
> > delete mode 100644 drivers/gpu/drm/xe/tests/xe_mocs_test.h
> >
> >diff --git a/drivers/gpu/drm/xe/tests/Makefile
> >b/drivers/gpu/drm/xe/tests/Makefile
> >index 32ce1d6df0fa..0e3408f4952c 100644
> >--- a/drivers/gpu/drm/xe/tests/Makefile
> >+++ b/drivers/gpu/drm/xe/tests/Makefile
> >@@ -2,8 +2,7 @@
> >
> > # "live" kunit tests
> > obj-$(CONFIG_DRM_XE_KUNIT_TEST) += xe_live_test.o -xe_live_test-y =
> >xe_live_test_mod.o \
> >- xe_mocs_test.o
> >+xe_live_test-y = xe_live_test_mod.o
> >
> > # Normal kunit tests
> > obj-$(CONFIG_DRM_XE_KUNIT_TEST) += xe_test.o diff --git
> >a/drivers/gpu/drm/xe/tests/xe_live_test_mod.c
> >b/drivers/gpu/drm/xe/tests/xe_live_test_mod.c
> >index 4c1e07a0d477..5f14737c8210 100644
> >--- a/drivers/gpu/drm/xe/tests/xe_live_test_mod.c
> >+++ b/drivers/gpu/drm/xe/tests/xe_live_test_mod.c
> >@@ -8,10 +8,12 @@
> > extern struct kunit_suite xe_bo_test_suite; extern struct kunit_suite
> >xe_dma_buf_test_suite; extern struct kunit_suite
> >xe_migrate_test_suite;
> >+extern struct kunit_suite xe_mocs_test_suite;
> >
> > kunit_test_suite(xe_bo_test_suite);
> > kunit_test_suite(xe_dma_buf_test_suite);
> > kunit_test_suite(xe_migrate_test_suite);
> >+kunit_test_suite(xe_mocs_test_suite);
> >
> > MODULE_AUTHOR("Intel Corporation");
> > MODULE_LICENSE("GPL");
> >diff --git a/drivers/gpu/drm/xe/tests/xe_mocs.c
> >b/drivers/gpu/drm/xe/tests/xe_mocs.c
> >index 67c65e88c384..b344608abdbf 100644
> >--- a/drivers/gpu/drm/xe/tests/xe_mocs.c
> >+++ b/drivers/gpu/drm/xe/tests/xe_mocs.c
> >@@ -6,7 +6,6 @@
> > #include <kunit/test.h>
> > #include <kunit/visibility.h>
> >
> >-#include "tests/xe_mocs_test.h"
> > #include "tests/xe_pci_test.h"
> > #include "tests/xe_test.h"
> >
> >@@ -134,11 +133,10 @@ static int mocs_kernel_test_run_device(struct
> xe_device *xe)
> > return 0;
> > }
> >
> >-void xe_live_mocs_kernel_kunit(struct kunit *test)
> >+static void xe_live_mocs_kernel_kunit(struct kunit *test)
> > {
> > xe_call_for_each_device(mocs_kernel_test_run_device);
> > }
> >-EXPORT_SYMBOL_IF_KUNIT(xe_live_mocs_kernel_kunit);
> >
> > static int mocs_reset_test_run_device(struct xe_device *xe) { @@
> >-175,8 +173,20 @@ static int mocs_reset_test_run_device(struct xe_device
> *xe)
> > return 0;
> > }
> >
> >-void xe_live_mocs_reset_kunit(struct kunit *test)
> >+static void xe_live_mocs_reset_kunit(struct kunit *test)
> > {
> > xe_call_for_each_device(mocs_reset_test_run_device);
> > }
> >-EXPORT_SYMBOL_IF_KUNIT(xe_live_mocs_reset_kunit);
> >+
> >+static struct kunit_case xe_mocs_tests[] = {
> >+ KUNIT_CASE(xe_live_mocs_kernel_kunit),
> >+ KUNIT_CASE(xe_live_mocs_reset_kunit),
> >+ {}
> >+};
> >+
> >+VISIBLE_IF_KUNIT
> >+struct kunit_suite xe_mocs_test_suite = {
> >+ .name = "xe_mocs",
> >+ .test_cases = xe_mocs_tests,
> >+};
> >+EXPORT_SYMBOL_IF_KUNIT(xe_mocs_test_suite);
> >diff --git a/drivers/gpu/drm/xe/tests/xe_mocs_test.c
> >b/drivers/gpu/drm/xe/tests/xe_mocs_test.c
> >deleted file mode 100644
> >index 6315886b659e..000000000000
> >--- a/drivers/gpu/drm/xe/tests/xe_mocs_test.c
> >+++ /dev/null
> >@@ -1,21 +0,0 @@
> >-// SPDX-License-Identifier: GPL-2.0
> >-/*
> >- * Copyright (c) 2022 Intel Corporation
> >- */
> >-
> >-#include "xe_mocs_test.h"
> >-
> >-#include <kunit/test.h>
> >-
> >-static struct kunit_case xe_mocs_tests[] = {
> >- KUNIT_CASE(xe_live_mocs_kernel_kunit),
> >- KUNIT_CASE(xe_live_mocs_reset_kunit),
> >- {}
> >-};
> >-
> >-static struct kunit_suite xe_mocs_test_suite = {
> >- .name = "xe_mocs",
> >- .test_cases = xe_mocs_tests,
> >-};
> >-
> >-kunit_test_suite(xe_mocs_test_suite);
> >diff --git a/drivers/gpu/drm/xe/tests/xe_mocs_test.h
> >b/drivers/gpu/drm/xe/tests/xe_mocs_test.h
> >deleted file mode 100644
> >index e7699d495411..000000000000
> >--- a/drivers/gpu/drm/xe/tests/xe_mocs_test.h
> >+++ /dev/null
> >@@ -1,14 +0,0 @@
> >-/* SPDX-License-Identifier: GPL-2.0 AND MIT */
> >-/*
> >- * Copyright (c) 2023 Intel Corporation
> >- */
> >-
> >-#ifndef _XE_MOCS_TEST_H_
> >-#define _XE_MOCS_TEST_H_
> >-
> >-struct kunit;
> >-
> >-void xe_live_mocs_kernel_kunit(struct kunit *test); -void
> >xe_live_mocs_reset_kunit(struct kunit *test);
> >-
> >-#endif
> >--
> >2.43.0
> >
More information about the Intel-xe
mailing list