From 2d167aaba3864cf8f46b8364aa33e780de1da8f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= Date: Sat, 11 Jun 2022 13:39:12 +0200 Subject: HID: uclogic: Add KUnit tests for uclogic_rdesc_template_apply() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The uclogic_rdesc_template_apply() function is used by the driver to generate HID descriptors from templates. In order to avoid regressions in future patches, add KUnit tests to test the function. To run the tests: $ ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/hid \ --kconfig_add CONFIG_VIRTIO_UML=y \ --kconfig_add CONFIG_UML_PCI_OVER_VIRTIO=y Signed-off-by: José Expósito Signed-off-by: Jiri Kosina --- drivers/hid/Kconfig | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'drivers/hid/Kconfig') diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index 70da5931082f..6ce92830b5d1 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig @@ -1306,6 +1306,22 @@ config HID_MCP2221 To compile this driver as a module, choose M here: the module will be called hid-mcp2221.ko. +config HID_KUNIT_TEST + bool "KUnit tests for HID" if !KUNIT_ALL_TESTS + depends on KUNIT=y + depends on HID_UCLOGIC + default KUNIT_ALL_TESTS + help + This builds unit tests for HID. This option is not useful for + distributions or general kernels, but only for kernel + developers working on HID and associated drivers. + + For more information on KUnit and unit tests in general, + please refer to the KUnit documentation in + Documentation/dev-tools/kunit/. + + If in doubt, say "N". + endmenu endif # HID -- cgit v1.2.3