[Libguestfs] [PATCH] drives: add CD-ROM disk images as read-only drives (RHBZ#563450).

Pino Toscano ptoscano at redhat.com
Thu Dec 19 15:29:31 UTC 2013


On Wednesday 18 December 2013 20:44:33 Richard W.M. Jones wrote:
> On Fri, Dec 13, 2013 at 04:32:49PM +0100, Pino Toscano wrote:
> > diff --git a/tests/regressions/rhbz563450.sh
> > b/tests/regressions/rhbz563450.sh new file mode 100755
> > index 0000000..6fa6f2b
> > --- /dev/null
> > +++ b/tests/regressions/rhbz563450.sh
> > @@ -0,0 +1,54 @@
> > +#!/bin/bash -
> > +# libguestfs
> > +# Copyright (C) 2013 Red Hat Inc.
> > +#
> > +# This program is free software; you can redistribute it and/or
> > modify +# it under the terms of the GNU General Public License as
> > published by +# the Free Software Foundation; either version 2 of
> > the License, or +# (at your option) any later version.
> > +#
> > +# This program is distributed in the hope that it will be useful,
> > +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > +# GNU General Public License for more details.
> > +#
> > +# You should have received a copy of the GNU General Public License
> > +# along with this program; if not, write to the Free Software
> > +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> > 02110-1301 USA. +
> > +# https://bugzilla.redhat.com/show_bug.cgi?id=563450
> > +# Test the order of added images
> > +
> > +set -e
> > +export LANG=C
> > +
> > +rm -f test.out
> > +
> > +../../fish/guestfish --ro > test.out <<EOF
> > +add-drive-ro ../guests/fedora.img
> > +add-cdrom ../data/test.iso
> > +add-drive-ro ../guests/debian.img
> > +
> > +run
> > +
> > +list-devices
> > +echo ----
> > +list-partitions
> > +
> > +ping-daemon
> > +EOF
> > +
> > +if [ "$(cat test.out)" != "/dev/sda
> > +/dev/sdb
> > +/dev/sdc
> > +----
> > +/dev/sda1
> > +/dev/sda2
> > +/dev/sdc1
> > +/dev/sdc2" ]; then
> 
> There's a bug in both of these tests, so I had to remove them in order
> to get a release out today.
> 
> 'list-devices' doesn't canonicalize disk names (perhaps it should, but
> it doesn't).  Therefore if the appliance is using old virtio-blk it
> will return disk names such as /dev/vda, and if the appliance is
> running under UML it will return /dev/ubda (which was what failed in
> 'make check-release').

You are right, it slipped in my checks.

> If you look at other tests such as:
> 
>  - df/test-virt-df.sh
>  - tests/luks/test-luks-list.sh
> 
> they get around this by canonicalizing the device names (in different
> ways) before comparing them.

I've taken this approach, although IMHO replacing the whole output just 
once at the end would be a cleaner approach than spreading sed+regexp 
all over the guestfish invocations.

> If you correct the bug then we can put the tests back.

Sending updated patch.

-- 
Pino Toscano




More information about the Libguestfs mailing list