Re: [PATCH] char: misc: make miscdevice unit test built-in only
From: Thadeu Lima de Souza Cascardo
Date: Mon May 05 2025 - 08:13:24 EST
On Mon, May 05, 2025 at 09:21:15AM +0200, Geert Uytterhoeven wrote:
> Hi Thadeu,
>
> On Wed, 30 Apr 2025 at 18:53, Thadeu Lima de Souza Cascardo
> <cascardo@xxxxxxxxxx> wrote:
> > Since it uses __init symbols, it cannot be a module. Builds with
> > CONFIG_TEST_MISC_MINOR=m will fail with:
> >
> > ERROR: modpost: "init_mknod" [drivers/misc/misc_minor_kunit.ko] undefined!
> > ERROR: modpost: "init_unlink" [drivers/misc/misc_minor_kunit.ko] undefined!
> >
> > Reported-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
> > Closes: https://lore.kernel.org/linux-next/20250429155404.2b6fe5b1@xxxxxxxxxxxxxxxx/
> > Reported-by: kernel test robot <lkp@xxxxxxxxx>
> > Closes: https://lore.kernel.org/oe-kbuild-all/202504160338.BjUL3Owb-lkp@xxxxxxxxx/
> > Fixes: 45f0de4f8dc3 ("char: misc: add test cases")
> > Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@xxxxxxxxxx>
>
> Thanks for your patch, which is now commit 20acf4dd46e4c090 ("char:
> misc: make miscdevice unit test built-in only") in char-misc-next.
>
> > --- a/lib/Kconfig.debug
> > +++ b/lib/Kconfig.debug
> > @@ -2512,7 +2512,7 @@ config TEST_IDA
> > tristate "Perform selftest on IDA functions"
> >
> > config TEST_MISC_MINOR
> > - tristate "miscdevice KUnit test" if !KUNIT_ALL_TESTS
> > + bool "miscdevice KUnit test" if !KUNIT_ALL_TESTS
> > depends on KUNIT
> > default KUNIT_ALL_TESTS
>
> This means "default y" if KUNIT_ALL_TESTS=m, which is IMHO not
> what we want.
>
The precedent for other kunit config options that are bool is that they use
"default KUNIT_ALL_TESTS".
It makes sense that if you choose to build all tests, you would not skip
the ones that cannot be built as a module.
Thanks.
Cascardo.
> Perhaps
>
> default KUNIT_ALL_TESTS=y
>
> ?
>
> > help
>
>
> 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