Skip to content

Commit 6bf065d

Browse files
committed
testsuite: add modinfo fallback custom ver test
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]>
1 parent 0155e2e commit 6bf065d

File tree

13 files changed

+32
-0
lines changed

13 files changed

+32
-0
lines changed

scripts/setup-rootfs.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ map=(
115115
["test-modinfo/mod-simple-pkcs7.ko"]="mod-simple.ko"
116116
["test-modinfo/external/lib/modules/external/mod-simple.ko"]="mod-simple.ko"
117117
["test-modinfo/fallback$MODULE_FALLBACK_DIRECTORY/4.4.4/kernel/"]="mod-simple.ko"
118+
["test-modinfo/fallback-custom$MODULE_FALLBACK_DIRECTORY/3.3.3/kernel/"]="mod-simple.ko"
118119
["test-weakdep$MODULE_DIRECTORY/4.4.4/kernel/mod-loop-a.ko"]="mod-loop-a.ko"
119120
["test-weakdep$MODULE_DIRECTORY/4.4.4/kernel/mod-loop-b.ko"]="mod-loop-b.ko"
120121
["test-weakdep$MODULE_DIRECTORY/4.4.4/kernel/mod-simple.ko"]="mod-simple.ko"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/run/modules/3.3.3/kernel/mod-simple.ko

testsuite/rootfs-pristine/test-modinfo/fallback-custom/proc/modules

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Aliases extracted from modules themselves.

testsuite/rootfs-pristine/test-modinfo/fallback-custom/run/modules/3.3.3/modules.builtin.bin

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
kernel/mod-simple.ko:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Device nodes to trigger on-demand module loading.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Soft dependencies extracted from modules themselves.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Aliases for symbols, used by symbol_request().

testsuite/test-modinfo.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,5 +147,30 @@ DEFINE_TEST(test_modinfo_fallback,
147147
.out = TESTSUITE_ROOTFS "test-modinfo/correct-fallback.txt",
148148
})
149149

150+
static noreturn int test_modinfo_fallback_custom(const struct test *t)
151+
{
152+
const char *const args[] = {
153+
// clang-format off
154+
progname,
155+
"-F", "filename",
156+
"--set-version",
157+
"3.3.3",
158+
"mod-simple",
159+
NULL,
160+
// clang-format on
161+
};
162+
test_spawn_prog(progname, args);
163+
exit(EXIT_FAILURE);
164+
}
165+
DEFINE_TEST(test_modinfo_fallback_custom,
166+
.description = "check if modinfo finds external module",
167+
.config = {
168+
[TC_ROOTFS] = TESTSUITE_ROOTFS "test-modinfo/fallback-custom",
169+
[TC_UNAME_R] = "4.4.4",
170+
},
171+
.output = {
172+
.out = TESTSUITE_ROOTFS "test-modinfo/correct-fallback-custom.txt",
173+
})
174+
150175

151176
TESTSUITE_MAIN();

0 commit comments

Comments
 (0)