Re: [PATCH] scsi: core: Make scsi_lib KUnit tests modular for real

From: Geert Uytterhoeven
Date: Tue Mar 19 2024 - 12:11:56 EST


Hoi Bart,

On Tue, Mar 19, 2024 at 5:03 PM Bart Van Assche <bvanassche@xxxxxxx> wrote:
> On 3/19/24 05:02, Geert Uytterhoeven wrote:
> > While SCSI_LIB_KUNIT_TEST is a tristate config symbol, configuring a
> > modular build of this test does not do anything: as the test code is
> > just included by the mid layer code, it only works in the built-in case.
> >
> > Fix this by converting the test to a stand-alone module. This requires
> > exporting scsi_check_passthrough() and adding a MODULE_LICENSE() tag.
>
> I don't like it that scsi_check_passthrough() is exported so that counts
> as a disadvantage of this patch. Why to convert scsi_lib_test into a

Perhaps the exported symbol should be __scsi_check_passthrough(),
to make it clearer this is not meant for general use?

> kernel module? What are the advantages compared to the current approach?
> That information is missing from the patch description.

SCSI_LIB_KUNIT_TEST is already tristate, so the original author must
have meant it to be modular. Or perhaps he just copied it from
(most/all) other tests ;-)

Anyway, I find it very useful to be able to do "modprobe kunit" and
"modprobe <test>" to run a test when I feel the need to do so.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68korg

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