diff options
| author | Thomas Zimmermann <tzimmermann@suse.de> | 2026-09-11 14:44:07 +0200 |
|---|---|---|
| committer | Thomas Zimmermann <tzimmermann@suse.de> | 2026-09-17 09:16:41 +0200 |
| commit | efb67f52fb36186935a56bc2ceda6567dfd97c47 (patch) | |
| tree | b4e48c68b8ff9af6079e6ad5eb9e7981886c2106 /drivers/gpu/drm/tests | |
| parent | 5c3d323984fd140108d527a920de8553ff6504b1 (diff) | |
| download | linux-next-efb67f52fb36186935a56bc2ceda6567dfd97c47.tar.gz linux-next-efb67f52fb36186935a56bc2ceda6567dfd97c47.zip | |
drm/panic: Compile KUnit tests as module
Fix dependency of the panic-helper KUnit tests on CONFIG_DRM_KUNIT_TEST=y
and make them build as a module. Export the necessary interfaces from the
panic helpers iff the KUnit framework has been enabled.
Select DRM_PANIC_HELPER from DRM_KUNIT_TEST to meet the dependencies of
the panic-helper tests.
It is now possible to run the tests by modprobe-ing drm_panic_helper_test
at runtime.
v5:
- clear test description with drm_panic_helper_clear_description() (Sashiko)
v3:
- clean up after each test case (Sashiko)
v2:
- fix parameter order in decl of drm_panic_helper_draw_screen_qr()
(Sashiko)
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://patch.msgid.link/20260911124540.279841-15-tzimmermann@suse.de
Diffstat (limited to 'drivers/gpu/drm/tests')
| -rw-r--r-- | drivers/gpu/drm/tests/Makefile | 1 | ||||
| -rw-r--r-- | drivers/gpu/drm/tests/drm_panic_helper_test.c | 21 |
2 files changed, 18 insertions, 4 deletions
diff --git a/drivers/gpu/drm/tests/Makefile b/drivers/gpu/drm/tests/Makefile index e7193b49cf91..42207df1d1c8 100644 --- a/drivers/gpu/drm/tests/Makefile +++ b/drivers/gpu/drm/tests/Makefile @@ -20,6 +20,7 @@ obj-$(CONFIG_DRM_KUNIT_TEST) += \ drm_managed_test.o \ drm_mm_test.o \ drm_modes_test.o \ + drm_panic_helper_test.o \ drm_plane_helper_test.o \ drm_probe_helper_test.o \ drm_rect_test.o \ diff --git a/drivers/gpu/drm/tests/drm_panic_helper_test.c b/drivers/gpu/drm/tests/drm_panic_helper_test.c index e6befe0f1c83..d0366e10d8c1 100644 --- a/drivers/gpu/drm/tests/drm_panic_helper_test.c +++ b/drivers/gpu/drm/tests/drm_panic_helper_test.c @@ -6,13 +6,17 @@ * KUNIT tests for DRM panic helpers */ -#include <drm/drm_fourcc.h> -#include <drm/drm_panic.h> +#include <linux/highmem.h> +#include <linux/units.h> +#include <linux/vmalloc.h> #include <kunit/test.h> -#include <linux/units.h> -#include <linux/vmalloc.h> +#include <drm/drm_fourcc.h> +#include <drm/drm_panic.h> +#include <drm/drm_panic_helper.h> + +MODULE_IMPORT_NS("EXPORTED_FOR_KUNIT_TESTING"); static void drm_panic_check_color_byte(struct kunit *test, u8 b) { @@ -86,6 +90,11 @@ static int drm_test_panic_init(struct kunit *test) return 0; } +static void drm_test_panic_exit(struct kunit *test) +{ + drm_panic_helper_clear_description(); +} + /* * Test drawing the panic screen, using a memory mapped framebuffer * Set the whole buffer to 0xa5, and then check that all pixels have been @@ -229,7 +238,11 @@ static struct kunit_case drm_panic_screen_user_test[] = { static struct kunit_suite drm_panic_helper_suite = { .name = "drm_panic_helper", .init = drm_test_panic_init, + .exit = drm_test_panic_exit, .test_cases = drm_panic_screen_user_test, }; kunit_test_suite(drm_panic_helper_suite); + +MODULE_DESCRIPTION("KUnit test suite for DRM panic handling"); +MODULE_LICENSE("GPL"); |
