[Parted-commits] GNU Parted Official Repository: Changes to 'master'

Jim Meyering meyering at alioth.debian.org
Mon Jan 9 14:30:12 UTC 2012


 tests/t8001-loop-blkpg.sh |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit b81cf3d3d63c5aaf7422ff689fd665b694351f47
Author: Jim Meyering <meyering at redhat.com>
Date:   Mon Jan 9 15:29:45 2012 +0100

    tests: root-only test would fail to remove its loop device
    
    * tests/t8001-loop-blkpg.sh: Ironically, when skipping this test,
    there was a race condition where in more than 7 out of 10 trials,
    this test's "losetup -d $dev" command would fail with "device in use".
    Hence, with enough testing, I would eventually use up all loop devices
    and start getting new test failures due to losetup *creation* failure.

diff --git a/tests/t8001-loop-blkpg.sh b/tests/t8001-loop-blkpg.sh
index cb7ba92..deef18b 100755
--- a/tests/t8001-loop-blkpg.sh
+++ b/tests/t8001-loop-blkpg.sh
@@ -23,7 +23,8 @@ require_udevadm_settle_
 
 cleanup_fn_()
 {
-  test -n "$loopdev" && losetup -d "$loopdev"
+  test -n "$loopdev" \
+    && { udevadm settle --timeout=3; losetup -d "$loopdev"; }
 }
 
 # If the loop module is loaded, unload it first
@@ -38,7 +39,7 @@ modprobe loop max_part=7 || fail=1
 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=$(losetup -f --show backing_file)
 test -z "$loopdev" && fail=1
 
 require_partitionable_loop_device_ $loopdev
@@ -53,7 +54,7 @@ compare /dev/null err || fail=1     # expect no output
 udevadm settle --timeout=5 || fail=1
 
 # Verify that the partition appeared in /proc/partitions
-entry=`basename "$loopdev"p1`
+entry=$(basename "$loopdev"p1)
 grep "$entry" /proc/partitions || { cat /proc/partitions; fail=1; }
 
 # Remove the partition



More information about the Parted-commits mailing list