Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/xe/kunit: Simplify xe_migrate live tests code layout

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-4-michal.wajdeczko@intel.com

+15 -37
-1
drivers/gpu/drm/xe/tests/Makefile
··· 3 3 # "live" kunit tests 4 4 obj-$(CONFIG_DRM_XE_KUNIT_TEST) += xe_live_test.o 5 5 xe_live_test-y = xe_live_test_mod.o \ 6 - xe_migrate_test.o \ 7 6 xe_mocs_test.o 8 7 9 8 # Normal kunit tests
+2
drivers/gpu/drm/xe/tests/xe_live_test_mod.c
··· 7 7 8 8 extern struct kunit_suite xe_bo_test_suite; 9 9 extern struct kunit_suite xe_dma_buf_test_suite; 10 + extern struct kunit_suite xe_migrate_test_suite; 10 11 11 12 kunit_test_suite(xe_bo_test_suite); 12 13 kunit_test_suite(xe_dma_buf_test_suite); 14 + kunit_test_suite(xe_migrate_test_suite); 13 15 14 16 MODULE_AUTHOR("Intel Corporation"); 15 17 MODULE_LICENSE("GPL");
+13 -3
drivers/gpu/drm/xe/tests/xe_migrate.c
··· 6 6 #include <kunit/test.h> 7 7 #include <kunit/visibility.h> 8 8 9 - #include "tests/xe_migrate_test.h" 10 9 #include "tests/xe_pci_test.h" 11 10 12 11 #include "xe_pci.h" ··· 353 354 return 0; 354 355 } 355 356 356 - void xe_migrate_sanity_kunit(struct kunit *test) 357 + static void xe_migrate_sanity_kunit(struct kunit *test) 357 358 { 358 359 xe_call_for_each_device(migrate_test_run_device); 359 360 } 360 - EXPORT_SYMBOL_IF_KUNIT(xe_migrate_sanity_kunit); 361 + 362 + static struct kunit_case xe_migrate_tests[] = { 363 + KUNIT_CASE(xe_migrate_sanity_kunit), 364 + {} 365 + }; 366 + 367 + VISIBLE_IF_KUNIT 368 + struct kunit_suite xe_migrate_test_suite = { 369 + .name = "xe_migrate", 370 + .test_cases = xe_migrate_tests, 371 + }; 372 + EXPORT_SYMBOL_IF_KUNIT(xe_migrate_test_suite);
-20
drivers/gpu/drm/xe/tests/xe_migrate_test.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * Copyright © 2022 Intel Corporation 4 - */ 5 - 6 - #include "xe_migrate_test.h" 7 - 8 - #include <kunit/test.h> 9 - 10 - static struct kunit_case xe_migrate_tests[] = { 11 - KUNIT_CASE(xe_migrate_sanity_kunit), 12 - {} 13 - }; 14 - 15 - static struct kunit_suite xe_migrate_test_suite = { 16 - .name = "xe_migrate", 17 - .test_cases = xe_migrate_tests, 18 - }; 19 - 20 - kunit_test_suite(xe_migrate_test_suite);
-13
drivers/gpu/drm/xe/tests/xe_migrate_test.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 AND MIT */ 2 - /* 3 - * Copyright © 2023 Intel Corporation 4 - */ 5 - 6 - #ifndef _XE_MIGRATE_TEST_H_ 7 - #define _XE_MIGRATE_TEST_H_ 8 - 9 - struct kunit; 10 - 11 - void xe_migrate_sanity_kunit(struct kunit *test); 12 - 13 - #endif