summaryrefslogtreecommitdiff
path: root/drivers/hid/hid-uclogic-rdesc-test.c
AgeCommit message (Collapse)AuthorFilesLines
2023-01-18HID: uclogic: Use KUNIT_EXPECT_MEMEQJosé Expósito1-2/+1
Commit b8a926bea8b1 ("kunit: Introduce KUNIT_EXPECT_MEMEQ and KUNIT_EXPECT_MEMNEQ macros") introduced a new macro to compare blocks of memory and, if the test fails, print the result in a human friendly format. For example, this is the output of a test failure: Expected res == params->expected, but res == 01 02 aa 00 00 00 03 bb 00 <00> 00 04 05 params->expected == 01 02 aa 00 00 00 03 bb 00 <01> 00 04 05 Use this new macro to replace KUNIT_EXPECT_EQ + memcmp. Signed-off-by: José Expósito <jose.exposito89@gmail.com> Reviewed-by: Maíra Canal <mairacanal@riseup.net> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2022-11-14HID: uclogic: Standardize test name prefixJosé Expósito1-2/+2
Commit 961bcdf956a4 ("drm/tests: Change "igt_" prefix to "drm_test_"") introduced a new naming convention for the KUnit tests present in the DRM subsystem: "drm_test_<module>_<test name>". This naming convention is very convenient because it allows to easily run all subsystem tests or all driver tests using kunit.py's wildcards. Follow the naming conventions used in the DRM subsystem adapted to the HID subsystem: "hid_test_<module>_<test name>". Signed-off-by: José Expósito <jose.exposito89@gmail.com> Reviewed-by: Maíra Canal <mairacanal@riseup.net> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2022-08-25HID: uclogic: KUnit best practices and naming conventionsJosé Expósito1-11/+11
The KUnit documentation [1] suggests allowing build tests as a module. In addition, it is recommended [2] to use snake case names for kunit_suite and test cases. Change the Kconfig entry from bool to tristate and stick to the naming conventions to avoid style issues with future tests. Link: https://docs.kernel.org/dev-tools/kunit/style.html#test-kconfig-entries [1] Link: https://www.kernel.org/doc/html/latest/dev-tools/kunit/style.html [2] Acked-by: Daniel Latypov <dlatypov@google.com> Signed-off-by: José Expósito <jose.exposito89@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2022-06-15HID: uclogic: Allow to generate frame templatesJosé Expósito1-0/+36
Add a new template placeholder to allow configuring the number of buttons in the drawing tablet frame and update the KUnit tests to cover the new case. Signed-off-by: José Expósito <jose.exposito89@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2022-06-15HID: uclogic: Add KUnit tests for uclogic_rdesc_template_apply()José Expósito1-0/+183
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 <jose.exposito89@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>