From: Lucas De Marchi Date: Thu, 14 Nov 2024 21:36:09 +0000 (-0600) Subject: testsuite: Test depmod with relative -m X-Git-Tag: v34~66 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ec3baed9f933e50ce84b7f404df4099e2f02bf04;p=thirdparty%2Fkmod.git testsuite: Test depmod with relative -m Signed-off-by: Lucas De Marchi Reviewed-by: Emil Velikov Link: https://github.com/kmod-project/kmod/pull/243 --- diff --git a/scripts/setup-rootfs.sh b/scripts/setup-rootfs.sh index 4e2194ee..cbf94bc9 100755 --- a/scripts/setup-rootfs.sh +++ b/scripts/setup-rootfs.sh @@ -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" diff --git a/testsuite/test-depmod.c b/testsuite/test-depmod.c index dd7ff9e6..ec157b2c 100644 --- a/testsuite/test-depmod.c +++ b/testsuite/test-depmod.c @@ -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"