All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lucas De Marchi <lucas.demarchi@intel.com>
To: linux-modules@vger.kernel.org
Cc: "Michal Suchánek" <msuchanek@suse.de>,
	"Petr Vorel" <petr.vorel@gmail.com>
Subject: [PATCH 1/2] testsuite: compress modules if feature is enabled
Date: Fri, 29 Jan 2021 18:35:59 -0800	[thread overview]
Message-ID: <20210130023600.24239-1-lucas.demarchi@intel.com> (raw)

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>
---
 Makefile.am                   |  2 +-
 testsuite/populate-modules.sh | 27 ++++++++++++++++++---------
 testsuite/test-depmod.c       |  2 --
 3 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index b29e943..24a586e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -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:
diff --git a/testsuite/populate-modules.sh b/testsuite/populate-modules.sh
index b0cc932..ae43884 100755
--- a/testsuite/populate-modules.sh
+++ b/testsuite/populate-modules.sh
@@ -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"
diff --git a/testsuite/test-depmod.c b/testsuite/test-depmod.c
index 261559c..d7802d7 100644
--- a/testsuite/test-depmod.c
+++ b/testsuite/test-depmod.c
@@ -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)
-- 
2.30.0


WARNING: multiple messages have this Message-ID (diff)
From: Petr Vorel <pvorel@suse.cz>
To: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: linux-modules@vger.kernel.org, "Michal Suchánek" <msuchanek@suse.de>
Subject: Re: [PATCH 1/2] testsuite: compress modules if feature is enabled
Date: Thu, 4 Feb 2021 11:24:48 +0100	[thread overview]
Message-ID: <20210130023600.24239-1-lucas.demarchi@intel.com> (raw)
Message-ID: <20210204102448.umXmKwV9iexUvrzwVjybzIIm9phiF_Hf84fJxHG4aAg@z> (raw)

Hi,

Reviewed-by: Petr Vorel <pvorel@suse.cz>
Great, thank you!

> +feature_enabled() {
> +	local feature=$1
> +	grep KMOD_FEATURES  $CONFIG_H | head -n 1 | grep -q \+$feature
nit: using grep single time is IMHO enough
grep -q "define KMOD_FEATURES.*\+$feature" $CONFIG_H
> +}

Kind regards,
Petr

             reply	other threads:[~2021-01-30  9:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-30  2:35 Lucas De Marchi [this message]
2021-02-04 10:24 ` [PATCH 1/2] testsuite: compress modules if feature is enabled Petr Vorel
2021-01-30  2:36 ` [PATCH 2/2] testsuite: also test xz compression Lucas De Marchi
2021-02-04 10:32   ` Petr Vorel
2021-02-06  3:59   ` Lucas De Marchi
2021-02-04  9:17 ` [PATCH 1/2] testsuite: compress modules if feature is enabled Michal Suchánek
2021-02-06  3:59 ` Lucas De Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210130023600.24239-1-lucas.demarchi@intel.com \
    --to=lucas.demarchi@intel.com \
    --cc=linux-modules@vger.kernel.org \
    --cc=msuchanek@suse.de \
    --cc=petr.vorel@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.