lib: packing: add KUnit tests adapted from selftests
authorJacob Keller <jacob.e.keller@intel.com>
Wed, 2 Oct 2024 21:51:55 +0000 (14:51 -0700)
committerJakub Kicinski <kuba@kernel.org>
Thu, 3 Oct 2024 22:32:04 +0000 (15:32 -0700)
commite9502ea6db8a457f0bc28a4a1f03517ad0547911
treebbf73383f1b155df1c2c516aa7f80c8445c1b251
parent28aec9ca29f05dabb835293acc6e202bf51b8092
lib: packing: add KUnit tests adapted from selftests

Add 24 simple KUnit tests for the lib/packing.c pack() and unpack() APIs.

The first 16 tests exercise all combinations of quirks with a simple magic
number value on a 16-byte buffer. The remaining 8 tests cover
non-multiple-of-4 buffer sizes.

These tests were originally written by Vladimir as simple selftest
functions. I adapted them to KUnit, refactoring them into a table driven
approach. This will aid in adding additional tests in the future.

Co-developed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Link: https://patch.msgid.link/20241002-packing-kunit-tests-and-split-pack-unpack-v2-6-8373e551eae3@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
MAINTAINERS
lib/Kconfig
lib/Makefile
lib/packing_test.c [new file with mode: 0644]