diff --git a/scripts/setup-rootfs.sh b/scripts/setup-rootfs.sh index 587f83c1..f6b47fc7 100755 --- a/scripts/setup-rootfs.sh +++ b/scripts/setup-rootfs.sh @@ -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" diff --git a/testsuite/rootfs-pristine/test-modinfo/correct-fallback-custom.txt b/testsuite/rootfs-pristine/test-modinfo/correct-fallback-custom.txt new file mode 100644 index 00000000..92d85ff0 --- /dev/null +++ b/testsuite/rootfs-pristine/test-modinfo/correct-fallback-custom.txt @@ -0,0 +1 @@ +/run/modules/3.3.3/kernel/mod-simple.ko diff --git a/testsuite/rootfs-pristine/test-modinfo/fallback-custom/proc/modules b/testsuite/rootfs-pristine/test-modinfo/fallback-custom/proc/modules new file mode 100644 index 00000000..e69de29b diff --git a/testsuite/rootfs-pristine/test-modinfo/fallback-custom/run/modules/3.3.3/modules.alias b/testsuite/rootfs-pristine/test-modinfo/fallback-custom/run/modules/3.3.3/modules.alias new file mode 100644 index 00000000..ba76e181 --- /dev/null +++ b/testsuite/rootfs-pristine/test-modinfo/fallback-custom/run/modules/3.3.3/modules.alias @@ -0,0 +1 @@ +# Aliases extracted from modules themselves. diff --git a/testsuite/rootfs-pristine/test-modinfo/fallback-custom/run/modules/3.3.3/modules.alias.bin b/testsuite/rootfs-pristine/test-modinfo/fallback-custom/run/modules/3.3.3/modules.alias.bin new file mode 100644 index 00000000..7075435f Binary files /dev/null and b/testsuite/rootfs-pristine/test-modinfo/fallback-custom/run/modules/3.3.3/modules.alias.bin differ diff --git a/testsuite/rootfs-pristine/test-modinfo/fallback-custom/run/modules/3.3.3/modules.builtin.bin b/testsuite/rootfs-pristine/test-modinfo/fallback-custom/run/modules/3.3.3/modules.builtin.bin new file mode 100644 index 00000000..e69de29b diff --git a/testsuite/rootfs-pristine/test-modinfo/fallback-custom/run/modules/3.3.3/modules.dep b/testsuite/rootfs-pristine/test-modinfo/fallback-custom/run/modules/3.3.3/modules.dep new file mode 100644 index 00000000..54766537 --- /dev/null +++ b/testsuite/rootfs-pristine/test-modinfo/fallback-custom/run/modules/3.3.3/modules.dep @@ -0,0 +1 @@ +kernel/mod-simple.ko: diff --git a/testsuite/rootfs-pristine/test-modinfo/fallback-custom/run/modules/3.3.3/modules.dep.bin b/testsuite/rootfs-pristine/test-modinfo/fallback-custom/run/modules/3.3.3/modules.dep.bin new file mode 100644 index 00000000..b09a8543 Binary files /dev/null and b/testsuite/rootfs-pristine/test-modinfo/fallback-custom/run/modules/3.3.3/modules.dep.bin differ diff --git a/testsuite/rootfs-pristine/test-modinfo/fallback-custom/run/modules/3.3.3/modules.devname b/testsuite/rootfs-pristine/test-modinfo/fallback-custom/run/modules/3.3.3/modules.devname new file mode 100644 index 00000000..58f6d6d6 --- /dev/null +++ b/testsuite/rootfs-pristine/test-modinfo/fallback-custom/run/modules/3.3.3/modules.devname @@ -0,0 +1 @@ +# Device nodes to trigger on-demand module loading. diff --git a/testsuite/rootfs-pristine/test-modinfo/fallback-custom/run/modules/3.3.3/modules.softdep b/testsuite/rootfs-pristine/test-modinfo/fallback-custom/run/modules/3.3.3/modules.softdep new file mode 100644 index 00000000..5554ccca --- /dev/null +++ b/testsuite/rootfs-pristine/test-modinfo/fallback-custom/run/modules/3.3.3/modules.softdep @@ -0,0 +1 @@ +# Soft dependencies extracted from modules themselves. diff --git a/testsuite/rootfs-pristine/test-modinfo/fallback-custom/run/modules/3.3.3/modules.symbols b/testsuite/rootfs-pristine/test-modinfo/fallback-custom/run/modules/3.3.3/modules.symbols new file mode 100644 index 00000000..618c345f --- /dev/null +++ b/testsuite/rootfs-pristine/test-modinfo/fallback-custom/run/modules/3.3.3/modules.symbols @@ -0,0 +1 @@ +# Aliases for symbols, used by symbol_request(). diff --git a/testsuite/rootfs-pristine/test-modinfo/fallback-custom/run/modules/3.3.3/modules.symbols.bin b/testsuite/rootfs-pristine/test-modinfo/fallback-custom/run/modules/3.3.3/modules.symbols.bin new file mode 100644 index 00000000..7075435f Binary files /dev/null and b/testsuite/rootfs-pristine/test-modinfo/fallback-custom/run/modules/3.3.3/modules.symbols.bin differ diff --git a/testsuite/test-modinfo.c b/testsuite/test-modinfo.c index d1c3f59e..f4c5b4b4 100644 --- a/testsuite/test-modinfo.c +++ b/testsuite/test-modinfo.c @@ -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();