]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
testsuite: Handle different sysconfdir
authorLucas De Marchi <lucas.de.marchi@gmail.com>
Thu, 9 Feb 2023 19:19:46 +0000 (11:19 -0800)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Fri, 10 Feb 2023 22:29:28 +0000 (14:29 -0800)
Instead of skipping tests if sysconfdir isn't /etc, just handle it
during the rootfs setup logic.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Makefile.am
configure.ac
testsuite/setup-rootfs.sh
testsuite/test-blacklist.c
testsuite/test-depmod.c
testsuite/test-modprobe.c

index 021b31547f7c983aa36ad4c817071170d712e0ac..61dbdf0ee76633413d241bbd0c8406ff8abbbe9d 100644 (file)
@@ -244,7 +244,7 @@ EXTRA_DIST += testsuite/setup-rootfs.sh
 MODULE_PLAYGROUND = testsuite/module-playground
 ROOTFS = testsuite/rootfs
 ROOTFS_PRISTINE = $(top_srcdir)/testsuite/rootfs-pristine
-CREATE_ROOTFS = $(AM_V_GEN) $(top_srcdir)/testsuite/setup-rootfs.sh $(ROOTFS_PRISTINE) $(ROOTFS) $(MODULE_PLAYGROUND) $(top_builddir)/config.h
+CREATE_ROOTFS = $(AM_V_GEN) $(top_srcdir)/testsuite/setup-rootfs.sh $(ROOTFS_PRISTINE) $(ROOTFS) $(MODULE_PLAYGROUND) $(top_builddir)/config.h $(sysconfdir)
 
 build-module-playground:
        $(AM_V_GEN)if test "$(top_srcdir)" != "$(top_builddir)"; then \
@@ -330,10 +330,6 @@ TESTSUITE_LDADD = \
        testsuite/libtestsuite.la libkmod/libkmod-internal.la \
        shared/libshared.la
 
-if KMOD_SYSCONFDIR_NOT_ETC
-TESTSUITE_CPPFLAGS += -DKMOD_SYSCONFDIR_NOT_ETC
-endif
-
 check_LTLIBRARIES += testsuite/libtestsuite.la
 testsuite_libtestsuite_la_SOURCES = \
        testsuite/testsuite.c testsuite/testsuite.h
index 12e0518533201ccf5da9c66d3fb2aa2c4eb6575c..892f5d9fbd1b650b12ce9b133b0e5e5250c9f855 100644 (file)
@@ -225,9 +225,6 @@ GTK_DOC_CHECK([1.14],[--flavour no-tmpl-flat])
 ], [
 AM_CONDITIONAL([ENABLE_GTK_DOC], false)])
 
-# Some tests are skipped when sysconfdir != /etc.
-AM_CONDITIONAL([KMOD_SYSCONFDIR_NOT_ETC], [test "x$sysconfdir" != "x/etc"])
-
 #####################################################################
 # Default CFLAGS and LDFLAGS
 #####################################################################
index d155a30de6dafad2c17a8a5413cd4ff622e52eb7..4440ddcd6b4d88a04f12ecef5ce6a6646ed62c4b 100755 (executable)
@@ -6,6 +6,7 @@ ROOTFS_PRISTINE=$1
 ROOTFS=$2
 MODULE_PLAYGROUND=$3
 CONFIG_H=$4
+SYSCONFDIR=$5
 
 # create rootfs from rootfs-pristine
 
@@ -15,6 +16,13 @@ create_rootfs() {
        cp -r "$ROOTFS_PRISTINE" "$ROOTFS"
        find "$ROOTFS" -type d -exec chmod +w {} \;
        find "$ROOTFS" -type f -name .gitignore -exec rm -f {} \;
+
+       if [ "$SYSCONFDIR" != "/etc" ]; then
+               find "$ROOTFS" -type d -name etc -printf "%h\n" | while read -r e; do
+                       mkdir -p "$(dirname $e/$SYSCONFDIR)"
+                       mv $e/{etc,$SYSCONFDIR}
+               done
+       fi
 }
 
 feature_enabled() {
index d03eedb60106c3472ed0859cf185d4e86a77945f..969567ddc81787c8729bcd3cfe4681d708f606f9 100644 (file)
@@ -95,9 +95,6 @@ fail_lookup:
 }
 
 DEFINE_TEST(blacklist_1,
-#if defined(KMOD_SYSCONFDIR_NOT_ETC)
-        .skip = true,
-#endif
        .description = "check if modules are correctly blacklisted",
        .config = {
                [TC_ROOTFS] = TESTSUITE_ROOTFS "test-blacklist/",
index d9104596a55792b992ce50a1f8c7edd74dd9c953..93606947f18adb03e26da2b7f717a3f8ce730fc9 100644 (file)
@@ -41,9 +41,6 @@ static noreturn int depmod_modules_order_for_compressed(const struct test *t)
 }
 
 DEFINE_TEST(depmod_modules_order_for_compressed,
-#if defined(KMOD_SYSCONFDIR_NOT_ETC)
-        .skip = true,
-#endif
        .description = "check if depmod let aliases in right order when using compressed modules",
        .config = {
                [TC_UNAME_R] = MODULES_UNAME,
@@ -74,9 +71,6 @@ static noreturn int depmod_modules_outdir(const struct test *t)
 }
 
 DEFINE_TEST(depmod_modules_outdir,
-#if defined(KMOD_SYSCONFDIR_NOT_ETC)
-        .skip = true,
-#endif
        .description = "check if depmod honours the outdir option",
        .config = {
                [TC_UNAME_R] = MODULES_UNAME,
@@ -159,9 +153,6 @@ static noreturn int depmod_detect_loop(const struct test *t)
        exit(EXIT_FAILURE);
 }
 DEFINE_TEST(depmod_detect_loop,
-#if defined(KMOD_SYSCONFDIR_NOT_ETC)
-        .skip = true,
-#endif
        .description = "check if depmod detects module loops correctly",
        .config = {
                [TC_UNAME_R] = MODULES_UNAME,
@@ -186,9 +177,6 @@ static noreturn int depmod_search_order_external_first(const struct test *t)
        exit(EXIT_FAILURE);
 }
 DEFINE_TEST(depmod_search_order_external_first,
-#if defined(KMOD_SYSCONFDIR_NOT_ETC)
-        .skip = true,
-#endif
        .description = "check if depmod honor external keyword with higher priority",
        .config = {
                [TC_UNAME_R] = MODULES_UNAME,
@@ -243,9 +231,6 @@ static noreturn int depmod_search_order_override(const struct test *t)
        exit(EXIT_FAILURE);
 }
 DEFINE_TEST(depmod_search_order_override,
-#if defined(KMOD_SYSCONFDIR_NOT_ETC)
-        .skip = true,
-#endif
        .description = "check if depmod honor override keyword",
        .config = {
                [TC_UNAME_R] = MODULES_UNAME,
index 3ddb976d920a8aee33e01ce6870ce836b689dd26..309f3e34c5fc84f3c874d68280916c66b8721ceb 100644 (file)
@@ -83,9 +83,6 @@ static noreturn int modprobe_show_alias_to_none(const struct test *t)
        exit(EXIT_FAILURE);
 }
 DEFINE_TEST(modprobe_show_alias_to_none,
-#if defined(KMOD_SYSCONFDIR_NOT_ETC)
-        .skip = true,
-#endif
        .description = "check if modprobe --show-depends doesn't explode with an alias to nothing",
        .config = {
                [TC_UNAME_R] = "4.4.4",
@@ -175,9 +172,6 @@ static noreturn int modprobe_softdep_loop(const struct test *t)
        exit(EXIT_FAILURE);
 }
 DEFINE_TEST(modprobe_softdep_loop,
-#if defined(KMOD_SYSCONFDIR_NOT_ETC)
-        .skip = true,
-#endif
        .description = "check if modprobe breaks softdep loop",
        .config = {
                [TC_UNAME_R] = "4.4.4",