[LTP] [PATCH 03/17] lib: tst_kernel: Add tst_check_module_driver()
Petr Vorel
pvorel@suse.cz
Thu Apr 2 23:47:27 CEST 2026
Hi Cyril,
> @@ -200,16 +200,18 @@ static int tst_search_driver(const char *driver, const char *file)
> int tst_check_builtin_driver(const char *driver)
> {
> - if (!tst_search_driver(driver, "modules.builtin"))
> - return 0;
> + return tst_search_driver(driver, "modules.builtin");
> +}
> - 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).
Unfortunately while this works for loadable modules (and IMHO worth to add it),
builtin modules are here only if they have a version or at least one parameter
[1]. And this will not work at least for hwpoison_inject.
Kind regards,
Petr
[1] https://www.kernel.org/doc/Documentation/ABI/stable/sysfs-module
More information about the ltp
mailing list