Thread (3 messages) 3 messages, 2 authors, 28d ago

Re: [PATCH v3] lib/random32: convert selftest to KUnit

From: Kir Chou <hidden>
Date: 2026-06-30 03:00:22
Also in: linux-kselftest, lkml

Yes it’s probably doable (done in v4), I didn’t do this to follow the existing design.

Sorry I forgot address the SoB format, I’ll handle if having v5…
On Jun 29, 2026, at 18:02, Geert Uytterhoeven [off-list ref] wrote:

Hi Kir,

Thanks for the update!
quoted
On Mon, 29 Jun 2026 at 07:42, Kir Chou [off-list ref] wrote:
This patch converts the existing prandom selftest (lib/random32.c) to use
the KUnit framework (lib/tests/random32_kunit.c). Unlike typical KUnit
tests, this file is directly #included into lib/random32.c.

The new test:
- Removes the legacy CONFIG_RANDOM32_SELFTEST from lib/random32.c.
- Adds CONFIG_PRANDOM_KUNIT_TEST (defaulting to KUNIT_ALL_TESTS).
- Moves the test logic to lib/tests/random32_kunit.c.

v2:
The changelog belongs under the "---" under your SoB.
quoted
- Removes the legacy CONFIG_RANDOM32_SELFTEST from lib/Kconfig.
- Add const to arrays in lib/tests/random32_kunit.c.

v3:
- Changes from tristate to bool in lib/Kconfig.debug.
That's (IMHO very) unfortunate...
quoted
--- a/lib/random32.c
+++ b/lib/random32.c
quoted
-core_initcall(prandom_state_selftest);
+#ifdef CONFIG_PRANDOM_KUNIT_TEST
+#include "tests/random32_kunit.c"
#endif
I guess that is the reason?

Any reason why the actual test code cannot be spun-off into a separate
module, so it can become modular?

Gr{oetje,eeting}s,

                       Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help