[LTP] [PATCH 2/4] lib: Add .modprobe
Petr Vorel
pvorel@suse.cz
Fri Oct 13 14:30:56 CEST 2023
Hi all,
maybe .modprobe is too short name, but I'm not sure what would be better.
Maybe .modprobe_module ?
...
> +++ b/doc/C-Test-API.asciidoc
> @@ -1609,6 +1609,11 @@ first missing driver.
> The detection is based on reading 'modules.dep' and 'modules.builtin' files
> generated by kmod. The check is skipped on Android.
> +NULL terminated array '.modprobe' of kernel module names are tried to be loaded
> +with 'modprobe' unless they are builtin or already loaded. Test exits with
> +'TCONF' on first 'modprobe' non-zero exit. During cleanup are the modules
> +loaded by the test unloaded with 'rmmod'.
...
> + if (tst_test->modprobe) {
> + const char *name;
> + int i;
> +
> + for (i = 0; (name = tst_test->modprobe[i]); ++i) {
> + /* only load module if not already loaded */
> + if (!module_loaded(name) && tst_check_builtin_driver(name)) {
Also we could make it independent on modules.builtin (NixOS based problem -
missing these files). I.e. we would keep only module_loaded(), remove
tst_check_builtin_driver(). But then we could not run rmmod / modprobe -r,
or we would have to ignore it's exit code (rmmod on builtin module) fails.
Kind regards,
Petr
> + const char *const cmd_modprobe[] = {"modprobe", name, NULL};
> + SAFE_CMD(cmd_modprobe, NULL, NULL);
> + modules_loaded[i] = 1;
> + }
> + }
> + }
> +
More information about the ltp
mailing list