Re: [PATCH] lib/crypto: tests: Depend on library options rather than selecting them
From: Geert Uytterhoeven
Date: Fri Feb 27 2026 - 03:33:15 EST
Hi Eric,
Thanks for your patch!
On Thu, 26 Feb 2026 at 20:20, Eric Biggers <ebiggers@xxxxxxxxxx> wrote:
> The convention for KUnit tests is to have the test kconfig options
> visible only when the code they depend on is already enabled. This way
> only the tests that are relevant to the particular kernel build can be
> enabled, either manually or via KUNIT_ALL_TESTS.
>
> Update lib/crypto/tests/Kconfig to follow that convention, i.e. depend
> on the corresponding library options rather than selecting them. This
> fixes an issue where enabling KUNIT_ALL_TESTS enabled non-test code.
>
> This does mean that it becomes more difficult to enable *all* the crypto
> library tests (which is what I do as a maintainer of the code), since
> doing so will now require enabling other options that select the
> libraries. Regardless, we should follow the standard KUnit convention.
>
> Note: currently most of the crypto library options are selected by
> visible options in crypto/Kconfig, which can be used to enable them
> without too much trouble. If in the future we end up with more cases
> like CRYPTO_LIB_CURVE25519 which is selected only by WIREGUARD (thus
> making CRYPTO_LIB_CURVE25519_KUNIT_TEST effectively depend on WIREGUARD
> after this commit), we could consider adding a new kconfig option that
> enables all the library code specifically for testing.
You can make those library symbols visible if KUNIT_ALL_TESTS, like
I suggested (after I sent my earlier reports to you) in [1], and like
Vladimir already did in [2].
> Reported-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
> Closes: https://lore.kernel.org/r/CAMuHMdVFRQZXCKJBOBDJtpENvpVO39AxGMUFWVQdM6xKTpnYYw@xxxxxxxxxxxxxx
[1] "Re: [PATCH v3 net-next 05/10] phy: add phy_get_rx_polarity()
and phy_get_tx_polarity()"
https://lore.kernel.org/CAMuHMdUBaoYKNj52gn8DQeZFZ42Cvm6xT6fvo0-_twNv1k3Jhg@xxxxxxxxxxxxxx/
[2] "[PATCH phy-fixes] phy: make PHY_COMMON_PROPS Kconfig symbol
conditionally user-selectable"
https://lore.kernel.org/20260226153315.3530378-1-vladimir.oltean@xxxxxxx/
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds