]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
testsuite: compress modules if feature is enabled
authorLucas De Marchi <lucas.demarchi@intel.com>
Sat, 30 Jan 2021 02:28:38 +0000 (18:28 -0800)
committerLucas De Marchi <lucas.demarchi@intel.com>
Sat, 6 Feb 2021 03:52:00 +0000 (19:52 -0800)
Since the output needs to be the same, regardless if the module is
compressed, change populate-modules.sh to conditionally compress the
module if that feature is enabled.

This way we can execute the tests with any build-time configuration and
it should still pass.

Suggested-by: Michal Suchánek <msuchanek@suse.de>
Reviewed-by: Michal Suchánek <msuchanek@suse.de>
Tested-by: Michal Suchánek <msuchanek@suse.de>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Makefile.am
testsuite/populate-modules.sh
testsuite/test-depmod.c

index b29e943a4d2997c4464fbc36b84307ad73fdd472..24a586e795ce2f2e489f06dcc948a1241ec4b23a 100644 (file)
@@ -249,7 +249,7 @@ CREATE_ROOTFS = $(AM_V_GEN) ( $(RM) -rf $(ROOTFS) && mkdir -p $(dir $(ROOTFS)) &
                                find $(ROOTFS) -type d -exec chmod +w {} \; && \
                                find $(ROOTFS) -type f -name .gitignore -exec rm -f {} \; && \
                                $(top_srcdir)/testsuite/populate-modules.sh \
-                                       $(MODULE_PLAYGROUND) $(ROOTFS) ) && \
+                                       $(MODULE_PLAYGROUND) $(ROOTFS) $(top_builddir)/config.h ) && \
                                touch testsuite/stamp-rootfs
 
 build-module-playground:
index b0cc932818e0b77b98a850e7a69e0c6b427be43a..ae43884984b842759fa5d9b0873957b52f12be61 100755 (executable)
@@ -4,6 +4,12 @@ set -e
 
 MODULE_PLAYGROUND=$1
 ROOTFS=$2
+CONFIG_H=$3
+
+feature_enabled() {
+       local feature=$1
+       grep KMOD_FEATURES  $CONFIG_H | head -n 1 | grep -q \+$feature
+}
 
 declare -A map
 map=(
@@ -99,15 +105,18 @@ done
 
 # start poking the final rootfs...
 
-# gzip these modules
-for m in "${gzip_array[@]}"; do
-    gzip "$ROOTFS/$m"
-done
-
-# zstd-compress these modules
-for m in "${zstd_array[@]}"; do
-    zstd --rm $ROOTFS/$m
-done
+# compress modules with each format if feature is enabled
+if feature_enabled ZLIB; then
+       for m in "${gzip_array[@]}"; do
+           gzip "$ROOTFS/$m"
+       done
+fi
+
+if feature_enabled ZSTD; then
+       for m in "${zstd_array[@]}"; do
+           zstd --rm $ROOTFS/$m
+       done
+fi
 
 for m in "${attach_sha1_array[@]}"; do
     cat "${MODULE_PLAYGROUND}/dummy.sha1" >>"${ROOTFS}/$m"
index 261559cab89bed3a2b06e583779070d1cfe851cc..d7802d7b2e0ba6b9f6a94af90c69694de1c72e50 100644 (file)
@@ -25,7 +25,6 @@
 
 #include "testsuite.h"
 
-#ifdef ENABLE_ZLIB
 #define MODULES_ORDER_UNAME "4.4.4"
 #define MODULES_ORDER_ROOTFS TESTSUITE_ROOTFS "test-depmod/modules-order-compressed"
 #define MODULES_ORDER_LIB_MODULES MODULES_ORDER_ROOTFS "/lib/modules/" MODULES_ORDER_UNAME
@@ -57,7 +56,6 @@ DEFINE_TEST(depmod_modules_order_for_compressed,
                        { }
                },
        });
-#endif
 
 #define SEARCH_ORDER_SIMPLE_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-simple"
 static noreturn int depmod_search_order_simple(const struct test *t)