public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
Subject: [gentoo-dev] [PATCH 4/4] eclass/tests/dist-kernel-utils.sh: add compressed_module_cleanup tests
Date: Tue,  6 Aug 2024 21:06:16 +0200	[thread overview]
Message-ID: <20240806190616.25975-4-andrewammerlaan@gentoo.org> (raw)
In-Reply-To: <20240806190616.25975-1-andrewammerlaan@gentoo.org>

Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
---
 eclass/tests/dist-kernel-utils.sh | 59 +++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git a/eclass/tests/dist-kernel-utils.sh b/eclass/tests/dist-kernel-utils.sh
index 50ba001f8e9c..28c8f7213a53 100755
--- a/eclass/tests/dist-kernel-utils.sh
+++ b/eclass/tests/dist-kernel-utils.sh
@@ -20,9 +20,68 @@ test_PV_to_KV() {
 	tend $?
 }
 
+test_compressed_module_cleanup() {
+	mkdir -p "${tmpdir}/source" || die
+	pushd "${tmpdir}" >/dev/null || die
+
+	local module option fail=0
+	for option in NONE GZIP XZ ZSTD; do
+		tbegin "CONFIG_MODULE_COMPRESS_${option}"
+		echo "CONFIG_MODULE_COMPRESS_${option}=y" > source/.config
+
+		touch a.ko b.ko.gz c.ko.xz d.ko.gz e.ko f.ko.xz || die
+		# ensure some files are older
+		touch -d "2 hours ago" d.ko e.ko.xz f.ko.gz || die
+
+		IUSE=modules-compress dist-kernel_compressed_module_cleanup .
+
+		local to_keep=( a.ko b.ko.gz c.ko.xz )
+		local to_remove=()
+
+		case ${option} in
+			NONE)
+				to_keep+=( d.ko e.ko f.ko.xz )
+				to_remove+=( d.ko.gz e.ko.xz f.ko.gz )
+				;;
+			GZIP)
+				to_keep+=( d.ko.gz e.ko f.ko.gz )
+				to_remove+=( d.ko e.ko.xz f.ko.xz )
+				;;
+			XZ)
+				to_keep+=( d.ko.gz e.ko.xz f.ko.xz )
+				to_remove+=( d.ko e.ko f.ko.gz )
+				;;
+			ZSTD)
+				to_keep+=( d.ko.gz e.ko f.ko.xz )
+				to_remove+=( d.ko e.ko.xz f.ko.gz )
+				;;
+		esac
+
+		for module in "${to_keep[@]}"; do
+			if [[ ! -f ${module} ]]; then
+				eerror "Module ${module} was removed"
+				fail=1
+			fi
+		done
+
+		for module in "${to_remove[@]}"; do
+			if [[ -f ${module} ]]; then
+				eerror "Module ${module} was not removed"
+				fail=1
+			fi
+		done
+		tend ${fail}
+	done
+
+	popd >/dev/null || die
+}
+
+
 test_PV_to_KV 6.0_rc1 6.0.0-rc1
 test_PV_to_KV 6.0 6.0.0
 test_PV_to_KV 6.0.1_rc1 6.0.1-rc1
 test_PV_to_KV 6.0.1 6.0.1
 
+test_compressed_module_cleanup
+
 texit
-- 
2.45.2



      parent reply	other threads:[~2024-08-06 19:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-06 19:06 [gentoo-dev] [PATCH 1/4] dist-kernel-utils.eclass: fix module cleanup when using binpkgs Andrew Ammerlaan
2024-08-06 19:06 ` [gentoo-dev] [PATCH 2/4] kernel-install.eclass: use dist-kernel_get_module_suffix to find compression Andrew Ammerlaan
2024-08-06 19:06 ` [gentoo-dev] [PATCH 3/4] eclass/tests/tests-common.sh: add in_iuse function Andrew Ammerlaan
2024-08-06 19:06 ` Andrew Ammerlaan [this message]

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=20240806190616.25975-4-andrewammerlaan@gentoo.org \
    --to=andrewammerlaan@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox