Skip to content

Commit

Permalink
drm/xe/kunit: Simplify xe_mocs live tests code layout
Browse files Browse the repository at this point in the history
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@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240708111210.1154-5-michal.wajdeczko@intel.com
  • Loading branch information
Michal Wajdeczko committed Jul 12, 2024
1 parent 0237368 commit e97701a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 42 deletions.
3 changes: 1 addition & 2 deletions drivers/gpu/drm/xe/tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/xe/tests/xe_live_test_mod.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
20 changes: 15 additions & 5 deletions drivers/gpu/drm/xe/tests/xe_mocs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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);
21 changes: 0 additions & 21 deletions drivers/gpu/drm/xe/tests/xe_mocs_test.c

This file was deleted.

14 changes: 0 additions & 14 deletions drivers/gpu/drm/xe/tests/xe_mocs_test.h

This file was deleted.

0 comments on commit e97701a

Please sign in to comment.