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

Cyril Hrubis
2023-11-01T16:34:45Z

Hi!
> > if (tst_test->mount_device)
> > tst_test->format_device = 1;
> >
> > @@ -1362,6 +1402,19 @@ static void do_cleanup(void)
> >
> > tst_sys_conf_restore(0);
> >
> > + if (tst_test->modprobe) {
> > + const char *name;
> > + int i;
> > +
> > + for (i = 0; (name = tst_test->modprobe[i]); ++i) {
> > + if (!modules_loaded[i])
> > + continue;
> > +
> > + const char *const cmd_rmmod[] = {"rmmod", name, NULL};
>
> modprobe -r please, rmmod has been deprecated for ages.

And one more minor point, we should attempt to remove the module only if
it has shown up in the /proc/modules.

Assuming that we want to skip the tst_module_is_buildin() check on some
systems as Ritchie suggested we would attempt to remove build in modules
here if we blindly trusted the return value from modpprobe.

--
Cyril Hrubis
chrubis@suse.cz