lib/crc: tests: Make crc_kunit test only the enabled CRC variantsLike commit 4478e8eeb871 ("lib/crypto: tests: Depend on library optionsrather than selecting them") did with the crypto library tes
lib/crc: tests: Make crc_kunit test only the enabled CRC variantsLike commit 4478e8eeb871 ("lib/crypto: tests: Depend on library optionsrather than selecting them") did with the crypto library tests, makecrc_kunit depend on the code it tests rather than selecting it. Thisfollows the standard convention for KUnit and fixes an issue whereenabling KUNIT_ALL_TESTS enabled non-test code.crc_kunit does differ from the crypto library tests in that itconsolidates the tests for multiple CRC variants, with 5 kconfigoptions, into one KUnit suite. Since depending on *all* of thesekconfig options would greatly restrict the ability to enable crc_kunit,instead just depend on *any* of these options. Update crc_kunitaccordingly to test only the reachable code.Alternatively we could split crc_kunit into 5 test suites. But keepingit as one is simpler for now.Fixes: e47d9b1a76ed ("lib/crc_kunit.c: add KUnit test suite for CRC library functions")Cc: stable@vger.kernel.orgLink: https://lore.kernel.org/r/20260306033557.250499-2-ebiggers@kernel.orgSigned-off-by: Eric Biggers <ebiggers@kernel.org>
show more ...
lib/crc: crc_kunit: Test CRC computation in interrupt contextsTest that if CRCs are computed in task, softirq, and hardirq contextconcurrently, then all results are as expected. Implement this us
lib/crc: crc_kunit: Test CRC computation in interrupt contextsTest that if CRCs are computed in task, softirq, and hardirq contextconcurrently, then all results are as expected. Implement this usingkunit_run_irq_test() which is also used by the lib/crypto/ tests.As with the corresponding lib/crypto/ tests, the purpose of this is totest fallback code paths and to exercise edge cases in thearchitecture's support for in-kernel FPU/SIMD/vector.Remove the code from crc_test() that sometimes disabled interrupts, asthat was just an incomplete attempt to achieve similar test coverage.Link: https://lore.kernel.org/r/20250811182631.376302-3-ebiggers@kernel.orgSigned-off-by: Eric Biggers <ebiggers@kernel.org>
lib/crc: Move files into lib/crc/Move all CRC files in lib/ into a subdirectory lib/crc/ to keep themfrom cluttering up the main lib/ directory.Reviewed-by: "Martin K. Petersen" <martin.petersen
lib/crc: Move files into lib/crc/Move all CRC files in lib/ into a subdirectory lib/crc/ to keep themfrom cluttering up the main lib/ directory.Reviewed-by: "Martin K. Petersen" <martin.petersen@oracle.com>Acked-by: Ingo Molnar <mingo@kernel.org>Acked-by: "Jason A. Donenfeld" <Jason@zx2c4.com>Link: https://lore.kernel.org/r/20250607200454.73587-2-ebiggers@kernel.orgSigned-off-by: Eric Biggers <ebiggers@kernel.org>