From ff479df0cbf03a024537d715e1831b357c5f331c Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Wed, 4 Jan 2012 14:26:20 +0100 Subject: [PATCH] tests: skip loop-partitioning tests when ext_range is < 2 * 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 | 8 ++++++++ tests/t8000-loop.sh | 2 ++ tests/t8001-loop-blkpg.sh | 2 ++ 3 files changed, 12 insertions(+) diff --git a/tests/init.cfg b/tests/init.cfg index 3109454..6072acd 100644 --- a/tests/init.cfg +++ b/tests/init.cfg @@ -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" diff --git a/tests/t8000-loop.sh b/tests/t8000-loop.sh index 92f843e..0939b6f 100755 --- a/tests/t8000-loop.sh +++ b/tests/t8000-loop.sh @@ -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 diff --git a/tests/t8001-loop-blkpg.sh b/tests/t8001-loop-blkpg.sh index 19d2ff9..cb7ba92 100755 --- a/tests/t8001-loop-blkpg.sh +++ b/tests/t8001-loop-blkpg.sh @@ -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 -- 2.11.0