parted/0035-tests-t8001-do-not-rely-on-modprobe-loop.patch
Brian C. Lane 73aa139585 - Rebase on parted master commit 1da239e2ebd2
- libparted: Fix bug with dupe and empty name
2014-06-13 09:52:56 -07:00

59 lines
1.7 KiB
Diff

From 569e59d08fe2ec5e836536371e0a974a58e83166 Mon Sep 17 00:00:00 2001
From: Gilles Espinasse <g.esp@free.fr>
Date: Sun, 7 Oct 2012 15:40:23 +0200
Subject: [PATCH 035/131] tests: t8001: do not rely on "modprobe loop"
Remove 'rmmod loop' and 'modprobe loop max_part=7' commands.
The latter command may fail after the first command has run,
leaving the machine with no loop support.
This happens on my chroot, because:
- rmmod does not depend on the availability of the loop module,
- modprobe fails, since the kernel compiled inside the chroot
is different from the running kernel.
Instead, rely on t-lvm loop_setup_ to load the loop module, if required.
---
tests/t8001-loop-blkpg.sh | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/tests/t8001-loop-blkpg.sh b/tests/t8001-loop-blkpg.sh
index deef18b..9afde4a 100755
--- a/tests/t8001-loop-blkpg.sh
+++ b/tests/t8001-loop-blkpg.sh
@@ -20,6 +20,7 @@
require_root_
require_udevadm_settle_
+lvm_init_root_dir_
cleanup_fn_()
{
@@ -27,21 +28,14 @@ cleanup_fn_()
&& { udevadm settle --timeout=3; losetup -d "$loopdev"; }
}
-# If the loop module is loaded, unload it first
-if lsmod | grep '^loop[[:space:]]'; then
- rmmod loop || fail=1
-fi
-
-# Insert loop module with max_part > 1
-modprobe loop max_part=7 || fail=1
-
# Create backing file
dd if=/dev/zero of=backing_file bs=1M count=4 >/dev/null 2>&1 || fail=1
# Set up loop device on top of backing file
-loopdev=$(losetup -f --show backing_file)
+loopdev=$(loop_setup_ backing_file)
test -z "$loopdev" && fail=1
+# Skip this test if loop devices are not partitionable.
require_partitionable_loop_device_ $loopdev
# Expect this to succeed
--
1.9.3