Re: [LTP] [PATCH 2/4] lib: Add .modprobe

Cyril Hrubis
2023-11-01T16:32:42Z

Hi!
> > What about renaming it as tst_module_is_loaded() and move into tst_kernel.h?
> > I guess we could make use of it widely for checking module loading or not.
>
> I can do that, but lib/tst_kernel.c uses the old API. I guess it would fit
> better in lib/tst_module.c, but that also uses the old API. Most of the tests
> are converted, but at least these modules are still in the old API and use
> tst_module_load from tst_module.h:
>
> IMHO We need another file, which would be new API only. I'm also not sure if
> it's a good idea to put another file with just single function to it. We already
> have 38 lib/tst_*.c files which use new API. Any tip, what to use?
> Or should I really put it into lib/tst_module.c ain include/tst_module.h, but
> not into include/old/old_module.h (as we want old tests to be converted first?).

I would just put the new functions into tst_module.h and we can put the
into tst_module_new.c in lib/ and move the function to tst_module.c once
the tst_module.c has been converted to new API.

> > And here print the name to tell people the module is loaded.
> +1

+1

> > This part could be as a separate function like tst_load_module() and
> > built single into another lib. We prefer to keep the main tst_test.c
> > as a simple outline.
>
> +1 for a separate function, it should be in the same file as
> tst_module_is_loaded().

+1

> > On the other hand, the extern functions can be used separately to let
> > modules to be loaded and unloaded during the test iteration.
> > It gives us more flexibility in test case design.
>
> Having it as the separate function would allow to use it in
> kvm_pagefault01.c and zram03.c - tiny simplification as they now call
> SAFE_CMD().
>
> kvm_pagefault01.c and can_common.h use them parameters, it might be worth
> to implement them.
>
> > Print unload module name.
> +1

+1

> > > + }
> > > + }
>
>
> > Here as well. something maybe like tst_unload_module().
>
> +1

+1

--
Cyril Hrubis
chrubis@suse.cz