[LTP] [PATCH 03/17] lib: tst_kernel: Add tst_check_module_driver()

Petr Vorel pvorel@suse.cz
Tue Apr 7 13:15:01 CEST 2026


> Hi!
> > > -	return -1;
> > > +int tst_check_module_driver(const char *driver)
> > > +{
> > > +	return tst_search_driver(driver, "modules.dep");

> > Thinking about it twice, could we check for the module by reading
> > /sys/module/? Our current approach shows what module *should* be available, but
> > that might not be true for some reason (i.e. loadable module not installed).

> The modules.dep file contains names of all modules installed in
> particular kernel modules directory. We cannot do anything better than
> parsing that file because it's (re)genrated on the system each time
> packages with modules have been installed/removed. If that wasn't the
> case modprobe that depends on that file wouldn't work either.

We effectively ask users to install modules.dep and modules.builtin. While this
is ok for distros and nobody has complained, I can imagine special embedded
systems can have problem. If everything was reliably detectable via /sys or
/proc I'd move to it. But even it's not working for all modules, checking first
/sys/module/ and fallback using modules.{builtin,dep} wouldn't take much effort.
But sure, we can postpone it until somebody has problems with the current
approach.

Kind regards,
Petr


More information about the ltp mailing list