OSDN Git Service

tests: skip loop-partitioning tests when ext_range is < 2
authorJim Meyering <meyering@redhat.com>
Wed, 4 Jan 2012 13:26:20 +0000 (14:26 +0100)
committerJim Meyering <meyering@redhat.com>
Thu, 5 Jan 2012 20:10:28 +0000 (21:10 +0100)
* tests/init.cfg (require_partitionable_loop_device_): New function.
* tests/t8001-loop-blkpg.sh: Use it.
* tests/t8000-loop.sh: Use it.

tests/init.cfg
tests/t8000-loop.sh
tests/t8001-loop-blkpg.sh

index 3109454..6072acd 100644 (file)
@@ -82,5 +82,13 @@ require_erasable_()
   $df | grep "^$dev_[0-9]" && fail_ "a partition of $dev_ is already mounted"
 }
 
+# At least Fedora 16 (kernel 3.1.6-1.fc16.x86_64) fails this test.
+require_partitionable_loop_device_()
+{
+  case $(cat /sys/devices/virtual/block/$(basename $1)/ext_range) in
+    0|1) skip_ your system does not support loop partitioning;;
+  esac
+}
+
 . "$abs_top_srcdir/tests/t-lib-helpers.sh"
 . "$abs_top_srcdir/tests/t-local.sh"
index 92f843e..0939b6f 100755 (executable)
@@ -31,6 +31,8 @@ cleanup_fn_()
 f1=$(pwd)/1; d1=$(loop_setup_ "$f1") \
   || skip_ "is this partition mounted with 'nodev'?"
 
+require_partitionable_loop_device_ $d1
+
 # Expect this to succeed.
 parted -s $d1 mklabel msdos > err 2>&1 || fail=1
 compare /dev/null err || fail=1     # expect no output
index 19d2ff9..cb7ba92 100755 (executable)
@@ -41,6 +41,8 @@ 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