Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1nGcXP-00049K-2V for mharc-grub-devel@gnu.org; Sun, 06 Feb 2022 03:04:48 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33036) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGcXK-00047b-B4 for grub-devel@gnu.org; Sun, 06 Feb 2022 03:04:43 -0500 Received: from [2607:f8b0:4864:20::82f] (port=36841 helo=mail-qt1-x82f.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nGcXH-0008JK-FU for grub-devel@gnu.org; Sun, 06 Feb 2022 03:04:41 -0500 Received: by mail-qt1-x82f.google.com with SMTP id z1so9564016qto.3 for ; Sun, 06 Feb 2022 00:04:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficientek-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SBS9m47lTMgXw50HsIVMXfXId3kQVttHrrtesi/ubIk=; b=rmMxRwyfwcfx/NoD0K29mtsFeqWOTkHfgu+Iyj1gNqOwmdzUOqyZQZXKd2pSHzYt77 jJo/pD2Cf/Ry2/BK/2o75DqyfQP+xulkUSc6nuUKZvTzy2/pT4uLCJzFKBgEV1Jglipj zb4pR7yXk2IJi61E+xf9g8xpPYG0q8UbYLO0oart1wnLuJxWQMWlAKigErb5Zo/20F0a LGOVjlx5huYGgjVxJridtpDjndDggP3GpRHpzdo5s6QvO3kWogCkyFA2KuoOUDObi3Mu wF8DwUQvfolTPVPqpbQyTFRnLEoEoKhO3GbCgtvsC0Vt0nmEGnSG8RFTD1twrbLlJwW1 /GyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SBS9m47lTMgXw50HsIVMXfXId3kQVttHrrtesi/ubIk=; b=eOSZj44MGfpUuyW5IPGjitLvQ73kQPbDxDd7LD9nmP2XFnSvlrRRpATE5GhBqwkpiN 0AlrVcMUrdLKvmzvyXbmLQ9VVHRKke3e6UVMmVxGP93rJeIfgEdu4v9/Aq/ZQOnlDxxz 2IFXOFiGL04pEKhoaoEMalHa02C0FzJsvuBG9JNJ1zKFHyhxKJUUIqHhMbahDOULO1dB 3fVXdf0/NFacn987r7forZRF8ZS+vWYEs0xpInZqfmJs55cXvGZPRIETE1b80AG8psX5 CCjJrRKYEtCoY+bhgz3gwEqTHN7dcYiTPQe/1MG5H4PK62M7jdANI2hrRHt0CnNEbjcf rwkQ== X-Gm-Message-State: AOAM530O8dFL+CSgm03bdPX7pWuGlPrSRi50pDyvmtVdsfRdHJqG2Hg0 MRpPIFZRodMraN2HTs/Y2JjwRw== X-Google-Smtp-Source: ABdhPJzphrH9VMHvSTW0KPTnJrL7Wrf3dyk5+HT7Zv7iygsGgmc/RnKVIuXvEuV2Y3kLQO6I3iPAIw== X-Received: by 2002:a05:622a:164a:: with SMTP id y10mr4524974qtj.257.1644134678703; Sun, 06 Feb 2022 00:04:38 -0800 (PST) Received: from localhost.localdomain (garza.riseup.net. [198.252.153.109]) by smtp.gmail.com with ESMTPSA id y2sm3549666qke.33.2022.02.06.00.04.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Feb 2022 00:04:38 -0800 (PST) From: Glenn Washburn To: Daniel Kiper , grub-devel@gnu.org Cc: Glenn Washburn Subject: [PATCH 5/5] tests: Ensure that loopback devices and zfs devices are cleaned up Date: Sun, 6 Feb 2022 02:02:44 -0600 Message-Id: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::82f (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::82f; envelope-from=development@efficientek.com; helo=mail-qt1-x82f.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Feb 2022 08:04:44 -0000 ZFS file systems are not unmounted using umount, but instead by exporting them. So export the ZFS file system that has the same label as the one that was created during the test, if such one exists. This is required to delete the loopback device that uses the ZFS image file. Otherwise the added code to delete all loopback devices setup during the test run will never be able to finish because the loopback device can not be deleted while in use. Signed-off-by: Glenn Washburn --- tests/util/grub-fs-tester.in | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/tests/util/grub-fs-tester.in b/tests/util/grub-fs-tester.in index ebd7b1e03..3bc3006de 100644 --- a/tests/util/grub-fs-tester.in +++ b/tests/util/grub-fs-tester.in @@ -14,14 +14,31 @@ tempdir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || XORRISOFS_CHARSET="-input-charset UTF-8 -output-charset UTF-8" MOUNTS= +LODEVICES= cleanup() { + if [ -n "$fs" -a -z "${fs##*zfs*}" -a -n "$FSLABEL" ]; then + zpool list "$FSLABEL" 2>/dev/null && + while ! zpool export "$FSLABEL" ; do + sleep 1; + done + fi + for i in $MOUNTS; do umount "$i" || : done + + for lodev in $LODEVICES; do + local i=600 + while losetup -l -O NAME | grep -q "^$lodev\$"; do + losetup -d "$lodev" || sleep 1 + [ "$((i--))" = "0" ] && break + done + done + return 0 } -trap umount_all EXIT INT +trap cleanup EXIT INT # This is for bash, dash and ash do not recognize ERR -trap umount_all ERR || : +trap cleanup ERR || : # This wrapper is to ease insertion of valgrind or time statistics run_it () { -- 2.27.0