From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 20AC8159C9B for ; Tue, 6 Aug 2024 19:07:30 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5BD872BC0B4; Tue, 6 Aug 2024 19:06:51 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id F41882BC0B1 for ; Tue, 6 Aug 2024 19:06:50 +0000 (UTC) From: Andrew Ammerlaan To: gentoo-dev@lists.gentoo.org Cc: Andrew Ammerlaan 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 Message-ID: <20240806190616.25975-4-andrewammerlaan@gentoo.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240806190616.25975-1-andrewammerlaan@gentoo.org> References: <20240806190616.25975-1-andrewammerlaan@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Archives-Salt: 395a29c5-b954-4964-b966-422dc091e1b1 X-Archives-Hash: 60eb9c63e1d217e2d73a925574b2c695 Signed-off-by: Andrew Ammerlaan --- 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