On Wed, 18 Jan 2023 at 00:50, Arnd Bergmann <arnd@xxxxxxxxxx> wrote: > > From: Arnd Bergmann <arnd@xxxxxxxx> > > Using kunit_fail_current_test() in a loadable module causes a link > error like: > > ERROR: modpost: "kunit_running" [drivers/gpu/drm/vc4/vc4.ko] undefined! > > Export the symbol to allow using it from modules. > > Fixes: da43ff045c3f ("drm/vc4: tests: Fail the current test if we access a register") > Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx> > --- Thanks for fixing this! I think the longer-term solution for this is the "hooks" approach (which works even when KUnit itself is built as a module): https://lore.kernel.org/all/20230117142737.246446-1-davidgow@xxxxxxxxxx/ But this looks good to fix it in the meantime. Reviewed-by: David Gow <davidgow@xxxxxxxxxx> Cheers, -- David > lib/kunit/test.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/lib/kunit/test.c b/lib/kunit/test.c > index c9ebf975e56b..890ba5b3a981 100644 > --- a/lib/kunit/test.c > +++ b/lib/kunit/test.c > @@ -21,6 +21,7 @@ > #include "try-catch-impl.h" > > DEFINE_STATIC_KEY_FALSE(kunit_running); > +EXPORT_SYMBOL_GPL(kunit_running); > > #if IS_BUILTIN(CONFIG_KUNIT) > /* > -- > 2.39.0 >
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature