History log of /linux-master/drivers/hid/hid-uclogic-rdesc-test.c
Revision Date Author Comments
# f5379a01 26-Dec-2022 José Expósito <jose.exposito89@gmail.com>

HID: uclogic: Use KUNIT_EXPECT_MEMEQ

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>


# af89dfde 10-Nov-2022 José Expósito <jose.exposito89@gmail.com>

HID: uclogic: Standardize test name prefix

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>


# 08809e48 15-Aug-2022 José Expósito <jose.exposito89@gmail.com>

HID: uclogic: KUnit best practices and naming conventions

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>


# 867c8925 11-Jun-2022 José Expósito <jose.exposito89@gmail.com>

HID: uclogic: Allow to generate frame templates

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>


# 2d167aab 11-Jun-2022 José Expósito <jose.exposito89@gmail.com>

HID: uclogic: Add KUnit tests for uclogic_rdesc_template_apply()

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>