testsuite/modprobe: add modprobe --show-exports modulename

Add test for the newly introduced --show-exports code path.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/353
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
This commit is contained in:
Emil Velikov 2025-05-30 20:16:11 +01:00 committed by Lucas De Marchi
parent 7816017f6e
commit 07f1abb965
12 changed files with 27 additions and 0 deletions

View File

@ -82,6 +82,7 @@ map=(
["test-modprobe/show-depends$MODULE_DIRECTORY/4.4.4/kernel/mod-loop-b.ko"]="mod-loop-b.ko"
["test-modprobe/show-depends$MODULE_DIRECTORY/4.4.4/kernel/mod-simple.ko"]="mod-simple.ko"
["test-modprobe/show-exports/mod-loop-a.ko"]="mod-loop-a.ko"
["test-modprobe/show-exports-module$MODULE_DIRECTORY/4.4.4/kernel/mod-loop-b.ko"]="mod-loop-b.ko"
["test-modprobe/softdep-loop$MODULE_DIRECTORY/4.4.4/kernel/mod-loop-a.ko"]="mod-loop-a.ko"
["test-modprobe/softdep-loop$MODULE_DIRECTORY/4.4.4/kernel/mod-loop-b.ko"]="mod-loop-b.ko"
["test-modprobe/weakdep-loop$MODULE_DIRECTORY/4.4.4/kernel/mod-loop-a.ko"]="mod-loop-a.ko"

View File

@ -0,0 +1 @@
0x[0-9a-fA-F]+ printB

View File

@ -0,0 +1 @@
# Aliases extracted from modules themselves.

View File

@ -0,0 +1,3 @@
kernel/mod-simple.ko:
kernel/mod-loop-b.ko:
kernel/mod-loop-a.ko: kernel/mod-loop-b.ko

View File

@ -0,0 +1 @@
# Device nodes to trigger on-demand module loading.

View File

@ -0,0 +1 @@
# Soft dependencies extracted from modules themselves.

View File

@ -0,0 +1,3 @@
# Aliases for symbols, used by symbol_request().
alias symbol:printB mod_loop_b
alias symbol:printA mod_loop_a

View File

@ -87,6 +87,22 @@ DEFINE_TEST(modprobe_show_exports,
.regex = true,
});
static noreturn int modprobe_show_exports_module(void)
{
EXEC_MODPROBE("--show-exports", "mod-loop-b");
exit(EXIT_FAILURE);
}
DEFINE_TEST(modprobe_show_exports_module,
.description = "check if modprobe --show-depends also works with module names",
.config = {
[TC_UNAME_R] = "4.4.4",
[TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/show-exports-module",
},
.output = {
.out = TESTSUITE_ROOTFS "test-modprobe/show-exports-module/correct.txt",
.regex = true,
});
static noreturn int modprobe_builtin(void)
{
EXEC_MODPROBE("unix");