Jim Meyering wrote: > Brian C. Lane wrote: >> On Wed, Dec 21, 2011 at 07:30:43PM +0100, Jim Meyering wrote: >>> On Fedora 16 (3.1.5-6.fc16.x86_64), the two t8000*loop.sh tests have >>> been failing for some time. I've finally investigated and found it is >>> due to this: >> >> It may be related to commit 1eb0cc30 where loop_get_partition_range was >> added. It reads from '/sys/module/loop/parameters/max_part' which on my >> F15 system (kernel 2.6.41.4-1.fc15.x86_64) returns 0. >> >> Partitioned loop devices certainly do work, so I think this is an error. >> I also am not sure what will happen with systems where loop is not a >> module. > > Hi Brian, > > I'm pretty sure this is an F16 kernel-related bug. > When I create a loop device like this on F16, > > truncate -s10m a && t=$(losetup --show -f a) > > and print its ext_range value, > > cat /sys/devices/virtual/block/$(basename $t)/ext_range > > I get "1", which means not partitionable, according to disk_max_parts > in include/linux/genhd.h which just returns gendisk.minors, described > like this: > > struct gendisk { > /* major, first_minor and minors are input parameters only, > * don't use directly. Use disk_devt() and disk_max_parts(). > */ > int major; /* major number of driver */ > int first_minor; > int minors; /* maximum number of minors, =1 for > > However, when I do the same on rawhide (3.2.0-0.rc7.git4.1.fc17.x86_64), > I get a reasonable value: 256. > > I've just filed a BZ for this: > http://bugzilla.redhat.com/771641
This makes us skip those two tests as long as the kernel lacks support: >From ef106f4a7da003e162024ac99417180169bb59eb Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyer...@redhat.com> 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(+), 0 deletions(-) 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 -- 1.7.8.1.391.g2c2ad