tests: guests: Add blank disks plus libvirt test:// XML.

You can now run virt-df and virt-alignment-scan on all of the test
guests by doing:

./run ./df/virt-df -c test:///path/to/tests/guests/guests.xml
./run ./align/virt-alignment-scan -c test:///path/to/tests/guests/guests.xml

which is kinda cool.
This commit is contained in:
Richard W.M. Jones
2013-02-26 16:47:38 +00:00
parent fe939cf842
commit 5ff3845d28
4 changed files with 281 additions and 2 deletions

2
.gitignore vendored
View File

@@ -429,11 +429,13 @@ Makefile.in
/tests/data/initrd-x86_64.img.gz
/tests/data/test-grep.txt.gz
/tests/data/test.iso
/tests/guests/blank-*.img
/tests/guests/debian.img
/tests/guests/fedora.img
/tests/guests/fedora-btrfs.img
/tests/guests/fedora-md1.img
/tests/guests/fedora-md2.img
/tests/guests/guests.xml
/tests/guests/guest-aux/fedora-name.db
/tests/guests/guest-aux/fedora-packages.db
/tests/guests/stamp-fedora-md.img

View File

@@ -1566,6 +1566,7 @@ AC_CONFIG_FILES([Makefile
tests/disks/Makefile
tests/disk-labels/Makefile
tests/guests/Makefile
tests/guests/guests.xml
tests/hotplug/Makefile
tests/luks/Makefile
tests/lvm/Makefile

View File

@@ -34,14 +34,37 @@ EXTRA_DIST = \
guest-aux/windows-software.reg \
guest-aux/windows-system \
guest-aux/windows-system.reg \
guest-aux/minimal-hive
guest-aux/minimal-hive \
guests.xml.in
# This is 'check_DATA' because we don't need it until 'make check'
# time and we need the tools we have built in order to make it.
check_DATA = debian.img fedora.img fedora-md1.img fedora-md2.img fedora-btrfs.img ubuntu.img windows.img
check_DATA = \
blank-disk.img \
blank-part.img \
blank-fs.img \
blank-bootroot.img \
blank-bootrootlv.img \
debian.img \
fedora.img \
fedora-md1.img \
fedora-md2.img \
fedora-btrfs.img \
ubuntu.img \
windows.img
CLEANFILES = $(check_DATA) stamp-fedora-md.img *.tmp.*
# Make several different blank images. These are not guests, but we
# include them in the libvirt fake XML to make sure that virt-df and
# virt-alignment-scan don't break when they encounter them.
blank-%.img:
rm -f $@ test1.img
$(top_builddir)/run \
../../fish/guestfish \
-N "$$(echo $@ | sed -e 's/blank-//' -e 's/.img//')" exit
mv test1.img $@
# Make a (dummy) Fedora image.
fedora.img: guest-aux/make-fedora-img.pl \
guest-aux/fedora-name.db \
@@ -105,4 +128,7 @@ guest-aux/windows-system: guest-aux/windows-system.reg
# Don't construct the guests in parallel. In automake 1.13, check_DATA
# was changed so it can now run in parallel, but this causes everything
# to fall over on machines with limited memory.
#
# ALSO: the guestfish rules above for making the blank-*.img files are
# NOT safe to run in parallel.
.NOTPARALLEL:

250
tests/guests/guests.xml.in Normal file
View File

@@ -0,0 +1,250 @@
<!--
libguestfs test images
@configure_input@
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.
To use the test guests by name, specify the following libvirt URI:
test://$(abs_builddir)/guests.xml
eg:
./run ./df/virt-df -c test://@abs_builddir@/guests.xml
./run ./align/virt-alignment-scan -c test://@abs_builddir@/guests.xml
-->
<node>
<!-- no disks -->
<domain type='test'>
<name>nodisks</name>
<memory>1048576</memory>
<os>
<type>hvm</type>
<boot dev='hd'/>
</os>
<devices>
</devices>
</domain>
<!-- deliberately missing disks -->
<domain type='test'>
<name>missing-disks</name>
<memory>1048576</memory>
<os>
<type>hvm</type>
<boot dev='hd'/>
</os>
<devices>
<disk type='file' device='disk'>
<driver name='qemu'/>
<source file='@abs_builddir@/no-such-disk.img'/>
<target dev='vda' bus='virtio'/>
</disk>
</devices>
</domain>
<domain type='test'>
<name>blank-bootroot</name>
<memory>1048576</memory>
<os>
<type>hvm</type>
<boot dev='hd'/>
</os>
<devices>
<disk type='file' device='disk'>
<driver name='qemu'/>
<source file='@abs_builddir@/blank-bootroot.img'/>
<target dev='vda' bus='virtio'/>
</disk>
</devices>
</domain>
<domain type='test'>
<name>blank-bootrootlv</name>
<memory>1048576</memory>
<os>
<type>hvm</type>
<boot dev='hd'/>
</os>
<devices>
<disk type='file' device='disk'>
<driver name='qemu'/>
<source file='@abs_builddir@/blank-bootrootlv.img'/>
<target dev='vda' bus='virtio'/>
</disk>
</devices>
</domain>
<domain type='test'>
<name>blank-disk</name>
<memory>1048576</memory>
<os>
<type>hvm</type>
<boot dev='hd'/>
</os>
<devices>
<disk type='file' device='disk'>
<driver name='qemu'/>
<source file='@abs_builddir@/blank-disk.img'/>
<target dev='vda' bus='virtio'/>
</disk>
</devices>
</domain>
<domain type='test'>
<name>blank-fs</name>
<memory>1048576</memory>
<os>
<type>hvm</type>
<boot dev='hd'/>
</os>
<devices>
<disk type='file' device='disk'>
<driver name='qemu'/>
<source file='@abs_builddir@/blank-fs.img'/>
<target dev='vda' bus='virtio'/>
</disk>
</devices>
</domain>
<domain type='test'>
<name>blank-part</name>
<memory>1048576</memory>
<os>
<type>hvm</type>
<boot dev='hd'/>
</os>
<devices>
<disk type='file' device='disk'>
<driver name='qemu'/>
<source file='@abs_builddir@/blank-part.img'/>
<target dev='vda' bus='virtio'/>
</disk>
</devices>
</domain>
<domain type='test'>
<name>debian</name>
<memory>1048576</memory>
<os>
<type>hvm</type>
<boot dev='hd'/>
</os>
<devices>
<disk type='file' device='disk'>
<driver name='qemu'/>
<source file='@abs_builddir@/debian.img'/>
<target dev='vda' bus='virtio'/>
</disk>
</devices>
</domain>
<domain type='test'>
<name>fedora-btrfs</name>
<memory>1048576</memory>
<os>
<type>hvm</type>
<boot dev='hd'/>
</os>
<devices>
<disk type='file' device='disk'>
<driver name='qemu'/>
<source file='@abs_builddir@/fedora-btrfs.img'/>
<target dev='vda' bus='virtio'/>
</disk>
</devices>
</domain>
<domain type='test'>
<name>fedora</name>
<memory>1048576</memory>
<os>
<type>hvm</type>
<boot dev='hd'/>
</os>
<devices>
<disk type='file' device='disk'>
<driver name='qemu'/>
<source file='@abs_builddir@/fedora.img'/>
<target dev='vda' bus='virtio'/>
</disk>
</devices>
</domain>
<domain type='test'>
<name>fedora-md1</name>
<memory>1048576</memory>
<os>
<type>hvm</type>
<boot dev='hd'/>
</os>
<devices>
<disk type='file' device='disk'>
<driver name='qemu'/>
<source file='@abs_builddir@/fedora-md1.img'/>
<target dev='vda' bus='virtio'/>
</disk>
</devices>
</domain>
<domain type='test'>
<name>fedora-md2</name>
<memory>1048576</memory>
<os>
<type>hvm</type>
<boot dev='hd'/>
</os>
<devices>
<disk type='file' device='disk'>
<driver name='qemu'/>
<source file='@abs_builddir@/fedora-md2.img'/>
<target dev='vda' bus='virtio'/>
</disk>
</devices>
</domain>
<domain type='test'>
<name>ubuntu</name>
<memory>1048576</memory>
<os>
<type>hvm</type>
<boot dev='hd'/>
</os>
<devices>
<disk type='file' device='disk'>
<driver name='qemu'/>
<source file='@abs_builddir@/ubuntu.img'/>
<target dev='vda' bus='virtio'/>
</disk>
</devices>
</domain>
<domain type='test'>
<name>windows</name>
<memory>1048576</memory>
<os>
<type>hvm</type>
<boot dev='hd'/>
</os>
<devices>
<disk type='file' device='disk'>
<driver name='qemu'/>
<source file='@abs_builddir@/windows.img'/>
<target dev='vda' bus='virtio'/>
</disk>
</devices>
</domain>
</node>