diff options
author | Eric Biggers <ebiggers@google.com> | 2024-12-01 17:20:52 -0800 |
---|---|---|
committer | Eric Biggers <ebiggers@google.com> | 2024-12-01 17:23:13 -0800 |
commit | e47d9b1a76ed78d0d50491f6a7d8ef59e379f45c (patch) | |
tree | 54f29b555e723a69dd1f375241046d47d1c6f70b /lib/Kconfig.debug | |
parent | 7439cfed1c41e5a1f3d095d3a4ffecdb13b279c4 (diff) |
lib/crc_kunit.c: add KUnit test suite for CRC library functions
Add a KUnit test suite for the crc16, crc_t10dif, crc32_le, crc32_be,
crc32c, and crc64_be library functions. It avoids code duplication by
sharing most logic among all CRC variants. The test suite includes:
- Differential fuzz test of each CRC function against a simple
bit-at-a-time reference implementation.
- Test for CRC combination, when implemented by a CRC variant.
- Optional benchmark of each CRC function with various data lengths.
This is intended as a replacement for crc32test and crc16_kunit, as well
as a new test for CRC variants which didn't previously have a test.
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Cc: Vinicius Peixoto <vpeixoto@lkcamp.dev>
Link: https://lore.kernel.org/r/20241202012056.209768-9-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
Diffstat (limited to 'lib/Kconfig.debug')
-rw-r--r-- | lib/Kconfig.debug | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index f3d723705879..d9b89dd3f6a0 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -2838,6 +2838,26 @@ config HW_BREAKPOINT_KUNIT_TEST If unsure, say N. +config CRC_KUNIT_TEST + tristate "KUnit tests for CRC functions" if !KUNIT_ALL_TESTS + depends on KUNIT + default KUNIT_ALL_TESTS + select CRC16 + select CRC_T10DIF + select CRC32 + select CRC64 + help + Unit tests for the CRC library functions. + + This is intended to help people writing architecture-specific + optimized versions. If unsure, say N. + +config CRC_BENCHMARK + bool "Benchmark for the CRC functions" + depends on CRC_KUNIT_TEST + help + Include benchmarks in the KUnit test suite for the CRC functions. + config SIPHASH_KUNIT_TEST tristate "Perform selftest on siphash functions" if !KUNIT_ALL_TESTS depends on KUNIT |