testsuite: Test depmod with relative -m

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/243
This commit is contained in:
Lucas De Marchi 2024-11-14 15:36:09 -06:00
parent d8b2455f40
commit ec3baed9f9
2 changed files with 20 additions and 0 deletions

View File

@ -104,6 +104,7 @@ map=(
["test-depmod/modules-outdir$MODULE_DIRECTORY/4.4.4/kernel/drivers/scsi/hpsa.ko"]="mod-fake-hpsa.ko"
["test-depmod/modules-outdir$MODULE_DIRECTORY/4.4.4/kernel/drivers/scsi/scsi_mod.ko"]="mod-fake-scsi-mod.ko"
["test-depmod/another-moddir/foobar/4.4.4/kernel/"]="mod-simple.ko"
["test-depmod/another-moddir/foobar2/4.4.4/kernel/"]="mod-simple.ko"
# TODO: add cross-compiled modules to the test
["test-modinfo/mod-simple.ko"]="mod-simple.ko"
["test-modinfo/mod-simple-sha1.ko"]="mod-simple.ko"

View File

@ -89,12 +89,18 @@ DEFINE_TEST(depmod_search_order_simple,
});
#define ANOTHER_MODDIR "/foobar"
#define RELATIVE_MODDIR "foobar2"
#define MODULES_ANOTHER_MODDIR_ROOTFS TESTSUITE_ROOTFS "test-depmod/another-moddir"
static noreturn int depmod_another_moddir(const struct test *t)
{
EXEC_DEPMOD("-m", ANOTHER_MODDIR);
exit(EXIT_FAILURE);
}
static noreturn int depmod_another_moddir_relative(const struct test *t)
{
EXEC_DEPMOD("-m", RELATIVE_MODDIR);
exit(EXIT_FAILURE);
}
DEFINE_TEST(depmod_another_moddir,
.description = "check depmod -m flag",
.config = {
@ -108,6 +114,19 @@ DEFINE_TEST(depmod_another_moddir,
{ },
},
});
DEFINE_TEST(depmod_another_moddir_relative,
.description = "check depmod -m flag with relative dir",
.config = {
[TC_UNAME_R] = MODULES_UNAME,
[TC_ROOTFS] = MODULES_ANOTHER_MODDIR_ROOTFS,
},
.output = {
.files = (const struct keyval[]) {
{ MODULES_ANOTHER_MODDIR_ROOTFS "/correct-modules.dep",
MODULES_ANOTHER_MODDIR_ROOTFS "/" RELATIVE_MODDIR "/" MODULES_UNAME "/modules.dep" },
{ },
},
});
#define SEARCH_ORDER_SAME_PREFIX_ROOTFS \
TESTSUITE_ROOTFS "test-depmod/search-order-same-prefix"