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

drm/vkms: Add KUnit test scaffolding

Add the required boilerplate to start creating KUnit test.

To run the tests:

$ ./tools/testing/kunit/kunit.py run \
--kunitconfig=drivers/gpu/drm/vkms/tests

Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com>
Co-developed-by: Arthur Grillo <arthurgrillo@riseup.net>
Signed-off-by: Arthur Grillo <arthurgrillo@riseup.net>
Co-developed-by: Louis Chauvet <louis.chauvet@bootlin.com>
Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250218101214.5790-4-jose.exposito89@gmail.com
Signed-off-by: Maxime Ripard <mripard@kernel.org>

authored by

José Expósito and committed by
Maxime Ripard
5b5a56d9 a833c588

+42
+15
drivers/gpu/drm/vkms/Kconfig
··· 14 14 a VKMS. 15 15 16 16 If M is selected the module will be called vkms. 17 + 18 + config DRM_VKMS_KUNIT_TEST 19 + tristate "KUnit tests for VKMS" if !KUNIT_ALL_TESTS 20 + depends on DRM_VKMS && KUNIT 21 + default KUNIT_ALL_TESTS 22 + help 23 + This builds unit tests for VKMS. This option is not useful for 24 + distributions or general kernels, but only for kernel 25 + developers working on VKMS. 26 + 27 + For more information on KUnit and unit tests in general, 28 + please refer to the KUnit documentation in 29 + Documentation/dev-tools/kunit/. 30 + 31 + If in doubt, say "N".
+1
drivers/gpu/drm/vkms/Makefile
··· 10 10 vkms_connector.o 11 11 12 12 obj-$(CONFIG_DRM_VKMS) += vkms.o 13 + obj-$(CONFIG_DRM_VKMS_KUNIT_TEST) += tests/
+4
drivers/gpu/drm/vkms/tests/.kunitconfig
··· 1 + CONFIG_KUNIT=y 2 + CONFIG_DRM=y 3 + CONFIG_DRM_VKMS=y 4 + CONFIG_DRM_VKMS_KUNIT_TEST=y
+3
drivers/gpu/drm/vkms/tests/Makefile
··· 1 + # SPDX-License-Identifier: GPL-2.0-only 2 + 3 + obj-$(CONFIG_DRM_VKMS_KUNIT_TEST) += vkms_config_test.o
+19
drivers/gpu/drm/vkms/tests/vkms_config_test.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 2 + 3 + #include <kunit/test.h> 4 + 5 + MODULE_IMPORT_NS("EXPORTED_FOR_KUNIT_TESTING"); 6 + 7 + static struct kunit_case vkms_config_test_cases[] = { 8 + {} 9 + }; 10 + 11 + static struct kunit_suite vkms_config_test_suite = { 12 + .name = "vkms-config", 13 + .test_cases = vkms_config_test_cases, 14 + }; 15 + 16 + kunit_test_suite(vkms_config_test_suite); 17 + 18 + MODULE_LICENSE("GPL"); 19 + MODULE_DESCRIPTION("Kunit test for vkms config utility");