bug-parted
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] parted-3.1, fix t8001 not to fail if modprobe fail


From: Gilles Espinasse
Subject: [PATCH] parted-3.1, fix t8001 not to fail if modprobe fail
Date: Sat, 6 Oct 2012 10:57:20 +0200

Signed-off-by: Gilles Espinasse <address@hidden>

Remove 'rmmod loop' and 'modprobe loop max_part=7' instructions
The second command may fail after the first command have run, leaving the 
machine with no loop support.

This happen on my chroot as
- rmmod do not depend if the loop module is available,
- modprobe does not work as the kernel compiled inside the chroot is different 
from the running kernel.

Instead detect earlier if the system support loop with partitions assuming all 
loop dev have the same number of allowed partitions
---
 tests/t8001-loop-blkpg.sh |   12 +++---------
 1 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/tests/t8001-loop-blkpg.sh b/tests/t8001-loop-blkpg.sh
index deef18b..e33d9ae 100755
--- a/tests/t8001-loop-blkpg.sh
+++ b/tests/t8001-loop-blkpg.sh
@@ -27,13 +27,9 @@ 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
+# Check on the first loop for the max_part supported on all loop
+# loop module with partition support require using modprobe loop max_part=7
+require_partitionable_loop_device_ /dev/loop0
 
 # Create backing file
 dd if=/dev/zero of=backing_file bs=1M count=4 >/dev/null 2>&1 || fail=1
@@ -42,8 +38,6 @@ dd if=/dev/zero of=backing_file bs=1M count=4 >/dev/null 2>&1 
|| fail=1
 loopdev=$(losetup -f --show backing_file)
 test -z "$loopdev" && fail=1
 
-require_partitionable_loop_device_ $loopdev
-
 # Expect this to succeed
 parted -s "$loopdev" mklabel msdos > err 2>&1 || fail=1
 compare /dev/null err || fail=1     # expect no output
-- 
1.7.2.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]