]> git.ipfire.org Git - thirdparty/linux.git/commit
lib/crc: tests: Make crc_kunit test only the enabled CRC variants
authorEric Biggers <ebiggers@kernel.org>
Fri, 6 Mar 2026 03:35:55 +0000 (19:35 -0800)
committerEric Biggers <ebiggers@kernel.org>
Mon, 9 Mar 2026 20:29:46 +0000 (13:29 -0700)
commit85c9f3a2b805eb96d899da7bcc38a16459aa3c16
tree107683598e38da64a85d86bc0160cf76ce598aa2
parent1f318b96cc84d7c2ab792fcc0bfd42a7ca890681
lib/crc: tests: Make crc_kunit test only the enabled CRC variants

Like commit 4478e8eeb871 ("lib/crypto: tests: Depend on library options
rather than selecting them") did with the crypto library tests, make
crc_kunit depend on the code it tests rather than selecting it.  This
follows the standard convention for KUnit and fixes an issue where
enabling KUNIT_ALL_TESTS enabled non-test code.

crc_kunit does differ from the crypto library tests in that it
consolidates the tests for multiple CRC variants, with 5 kconfig
options, into one KUnit suite.  Since depending on *all* of these
kconfig options would greatly restrict the ability to enable crc_kunit,
instead just depend on *any* of these options.  Update crc_kunit
accordingly to test only the reachable code.

Alternatively we could split crc_kunit into 5 test suites.  But keeping
it as one is simpler for now.

Fixes: e47d9b1a76ed ("lib/crc_kunit.c: add KUnit test suite for CRC library functions")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20260306033557.250499-2-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
lib/crc/Kconfig
lib/crc/tests/crc_kunit.c