Skip to content

Commit

Permalink
testsuite: add modinfo fallback custom ver test
Browse files Browse the repository at this point in the history
Check whether modinfo --set-version is able to find modules in
/run/modules/<custom-ver> when /lib/modules/<custom-ver> is missing.

Signed-off-by: Vitaly Kuznetsov <[email protected]>
  • Loading branch information
vittyvk committed Oct 23, 2024
1 parent 0155e2e commit 6bf065d
Show file tree
Hide file tree
Showing 13 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions scripts/setup-rootfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ map=(
["test-modinfo/mod-simple-pkcs7.ko"]="mod-simple.ko"
["test-modinfo/external/lib/modules/external/mod-simple.ko"]="mod-simple.ko"
["test-modinfo/fallback$MODULE_FALLBACK_DIRECTORY/4.4.4/kernel/"]="mod-simple.ko"
["test-modinfo/fallback-custom$MODULE_FALLBACK_DIRECTORY/3.3.3/kernel/"]="mod-simple.ko"
["test-weakdep$MODULE_DIRECTORY/4.4.4/kernel/mod-loop-a.ko"]="mod-loop-a.ko"
["test-weakdep$MODULE_DIRECTORY/4.4.4/kernel/mod-loop-b.ko"]="mod-loop-b.ko"
["test-weakdep$MODULE_DIRECTORY/4.4.4/kernel/mod-simple.ko"]="mod-simple.ko"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/run/modules/3.3.3/kernel/mod-simple.ko
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Aliases extracted from modules themselves.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
kernel/mod-simple.ko:
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Device nodes to trigger on-demand module loading.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Soft dependencies extracted from modules themselves.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Aliases for symbols, used by symbol_request().
Binary file not shown.
25 changes: 25 additions & 0 deletions testsuite/test-modinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,5 +147,30 @@ DEFINE_TEST(test_modinfo_fallback,
.out = TESTSUITE_ROOTFS "test-modinfo/correct-fallback.txt",
})

static noreturn int test_modinfo_fallback_custom(const struct test *t)
{
const char *const args[] = {
// clang-format off
progname,
"-F", "filename",
"--set-version",
"3.3.3",
"mod-simple",
NULL,
// clang-format on
};
test_spawn_prog(progname, args);
exit(EXIT_FAILURE);
}
DEFINE_TEST(test_modinfo_fallback_custom,
.description = "check if modinfo finds external module",
.config = {
[TC_ROOTFS] = TESTSUITE_ROOTFS "test-modinfo/fallback-custom",
[TC_UNAME_R] = "4.4.4",
},
.output = {
.out = TESTSUITE_ROOTFS "test-modinfo/correct-fallback-custom.txt",
})


TESTSUITE_MAIN();

0 comments on commit 6bf065d

Please sign in to comment.