Only df/test-virt-df-guests.sh was using the facility of testing
guests with missing/no disks, so let's change just that test instead.
---
.gitignore | 1 -
align/test-virt-alignment-scan-guests.sh | 2 +-
configure.ac | 1 -
df/test-virt-df-guests-missing.sh | 140 ++++++++++++
df/tests.mk | 1 +
generator/test_harness.ml | 4 +-
generator/tests.ml | 1 +
tests/guests/Makefile.am | 9 +-
tests/guests/guest-aux/make-guests-all-good.pl | 70 ------
tests/guests/guest-aux/make-guests-xml.pl | 65 ++++++
tests/guests/guests.xml.in | 282 -------------------------
11 files changed, 214 insertions(+), 362 deletions(-)
create mode 100755 df/test-virt-df-guests-missing.sh
delete mode 100755 tests/guests/guest-aux/make-guests-all-good.pl
create mode 100755 tests/guests/guest-aux/make-guests-xml.pl
delete mode 100644 tests/guests/guests.xml.in
diff --git a/.gitignore b/.gitignore
index e35a7b3..49e6391 100644
--- a/.gitignore
+++ b/.gitignore
@@ -542,7 +542,6 @@ Makefile.in
/tests/guests/fedora-md1.img
/tests/guests/fedora-md2.img
/tests/guests/guests.xml
-/tests/guests/guests-all-good.xml
/tests/guests/guest-aux/fedora-name.db
/tests/guests/guest-aux/fedora-packages.db
/tests/guests/guest-aux/windows-software
diff --git a/align/test-virt-alignment-scan-guests.sh
b/align/test-virt-alignment-scan-guests.sh
index a013705..12acb67 100755
--- a/align/test-virt-alignment-scan-guests.sh
+++ b/align/test-virt-alignment-scan-guests.sh
@@ -18,7 +18,7 @@
export LANG=C
-libvirt_uri="test://$phonydir/guests-all-good.xml"
+libvirt_uri="test://$phonydir/guests.xml"
$VG virt-alignment-scan -c "$libvirt_uri"
r=$?
diff --git a/configure.ac b/configure.ac
index 8ed6db8..4a85584 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1804,7 +1804,6 @@ AC_CONFIG_FILES([Makefile
tests/events/Makefile
tests/fuzz/Makefile
tests/guests/Makefile
- tests/guests/guests.xml
tests/hotplug/Makefile
tests/http/Makefile
tests/journal/Makefile
diff --git a/df/test-virt-df-guests-missing.sh b/df/test-virt-df-guests-missing.sh
new file mode 100755
index 0000000..b4ac07b
--- /dev/null
+++ b/df/test-virt-df-guests-missing.sh
@@ -0,0 +1,140 @@
+#!/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.
+
+# Run virt-df on the test guests.
+
+export LANG=C
+set -e
+
+cat > missing.xml <<EOF
+<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' type='raw'/>
+ <source file='/no-such-disk.img'/>
+ <target dev='vda' bus='virtio'/>
+ </disk>
+ </devices>
+ </domain>
+
+ <!-- various blank / non-OS disks -->
+ <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' type='raw'/>
+ <source file='$phonydir/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' type='raw'/>
+ <source file='$phonydir/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' type='raw'/>
+ <source file='$phonydir/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' type='raw'/>
+ <source file='$phonydir/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' type='raw'/>
+ <source file='$phonydir/blank-part.img'/>
+ <target dev='vda' bus='virtio'/>
+ </disk>
+ </devices>
+ </domain>
+</node>
+EOF
+
+libvirt_uri="test://$tmpdir/missing.xml"
+
+$VG virt-df -c "$libvirt_uri"
diff --git a/df/tests.mk b/df/tests.mk
index da5f0e7..ad65e35 100644
--- a/df/tests.mk
+++ b/df/tests.mk
@@ -22,6 +22,7 @@
localtestsdir = $(alltestsdir)/df
localtests_SCRIPTS = \
+ test-virt-df-guests-missing.sh \
test-virt-df-guests.sh \
test-virt-df-local-guests.sh \
test-virt-df.sh
diff --git a/generator/test_harness.ml b/generator/test_harness.ml
index 1f6bf90..fa9b080 100644
--- a/generator/test_harness.ml
+++ b/generator/test_harness.ml
@@ -510,10 +510,10 @@ Options:" in
(* Make XML describing all guests we managed to create above. *)
let cmd =
- sprintf "%s/make-guests-all-good.pl > guests-all-good.xml blank-disk.img
blank-part.img blank-fs.img blank-bootroot.img blank-bootrootlv.img archlinux.img
coreos.img debian.img fedora.img fedora-md1.img fedora-md2.img fedora-btrfs.img ubuntu.img
windows.img"
+ sprintf "%s/make-guests-xml.pl > guests.xml blank-disk.img blank-part.img
blank-fs.img blank-bootroot.img blank-bootrootlv.img archlinux.img coreos.img debian.img
fedora.img fedora-md1.img fedora-md2.img fedora-btrfs.img ubuntu.img windows.img"
gaux in
if Sys.command cmd <> 0 then
- failwith "make-guests-all-good.pl failed";
+ failwith "make-guests-xml.pl failed";
let cmd = "rm -f *.tmp.*" in
ignore (Sys.command cmd);
diff --git a/generator/tests.ml b/generator/tests.ml
index a214fa7..8ca33e3 100644
--- a/generator/tests.ml
+++ b/generator/tests.ml
@@ -425,6 +425,7 @@ let tests = [
check = [
"test-virt-df.sh";
"test-virt-df-guests.sh";
+ "test-virt-df-guests-missing.sh";
];
check_local_guests = [
"test-virt-df-local-guests.sh";
diff --git a/tests/guests/Makefile.am b/tests/guests/Makefile.am
index 796d428..8f5ebdc 100644
--- a/tests/guests/Makefile.am
+++ b/tests/guests/Makefile.am
@@ -37,8 +37,7 @@ EXTRA_DIST = \
guest-aux/windows-system \
guest-aux/windows-system.reg \
guest-aux/minimal-hive \
- guest-aux/make-guests-all-good.pl \
- guests.xml.in
+ guest-aux/make-guests-xml.pl
disk_images = \
blank-disk.img \
@@ -58,9 +57,9 @@ disk_images = \
# 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 = $(disk_images) guests-all-good.xml
+check_DATA = $(disk_images) guests.xml
-$(disk_images) guests-all-good.xml: stamp-guests
+$(disk_images) guests.xml: stamp-guests
stamp-guests: $(top_builddir)/test-harness
$(top_builddir)/run $< --make-phony-guests-only
@@ -88,7 +87,7 @@ localtests_SCRIPTS = \
guest-aux/make-coreos-img.sh \
guest-aux/make-debian-img.sh \
guest-aux/make-fedora-img.pl \
- guest-aux/make-guests-all-good.pl \
+ guest-aux/make-guests-xml.pl \
guest-aux/make-ubuntu-img.sh \
guest-aux/make-windows-img.sh
diff --git a/tests/guests/guest-aux/make-guests-all-good.pl
b/tests/guests/guest-aux/make-guests-all-good.pl
deleted file mode 100755
index aafcc8e..0000000
--- a/tests/guests/guest-aux/make-guests-all-good.pl
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/usr/bin/perl
-# 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.
-
-# Make the ../guests-all-good.xml file.
-
-use strict;
-use warnings;
-
-my $outdir = `pwd`; chomp $outdir;
-
-print <<__EOT__;
-<!--
-This file is generated from $0.
-
-ANY CHANGES YOU MAKE TO THIS FILE WILL BE LOST.
-
-To use the test guests by name, specify the following libvirt URI:
-test://\$(abs_builddir)/guests-all-good.xml
-
-eg:
- ./run ./df/virt-df -c test://$outdir/guests-all-good.xml
- ./run ./align/virt-alignment-scan -c test://$outdir/guests-all-good.xml
-
-Note this differs from 'guests.xml' just in that none of these guests
-have missing disks, etc.
--->
-<node>
-__EOT__
-
-foreach (@ARGV) {
- my $name = $_;
- $name =~ s/.img//;
-
- if (-f $_ && -s $_) {
- print <<__EOT__;
- <domain type='test'>
- <name>$name</name>
- <memory>1048576</memory>
- <os>
- <type>hvm</type>
- <boot dev='hd'/>
- </os>
- <devices>
- <disk type='file' device='disk'>
- <driver name='qemu' type='raw'/>
- <source file='$outdir/$_'/>
- <target dev='vda' bus='virtio'/>
- </disk>
- </devices>
- </domain>
-__EOT__
- }
-}
-
-print "</node>";
diff --git a/tests/guests/guest-aux/make-guests-xml.pl
b/tests/guests/guest-aux/make-guests-xml.pl
new file mode 100755
index 0000000..5237921
--- /dev/null
+++ b/tests/guests/guest-aux/make-guests-xml.pl
@@ -0,0 +1,65 @@
+#!/usr/bin/perl
+# libguestfs
+# Copyright (C) 2013-2015 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.
+
+# Make the guests.xml file.
+
+use strict;
+use warnings;
+
+my $outdir = `pwd`; chomp $outdir;
+
+print <<__EOT__;
+<!--
+This file is generated from
+$0.
+
+ANY CHANGES YOU MAKE TO THIS FILE WILL BE LOST.
+
+To use the test guests by name, specify the following libvirt URI:
+test://\$phonydir/guests.xml
+
+-->
+<node>
+__EOT__
+
+foreach (@ARGV) {
+ my $name = $_;
+ $name =~ s/.img//;
+
+ if (-f $_ && -s $_) {
+ print <<__EOT__;
+ <domain type='test'>
+ <name>$name</name>
+ <memory>1048576</memory>
+ <os>
+ <type>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <devices>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source file='$outdir/$_'/>
+ <target dev='vda' bus='virtio'/>
+ </disk>
+ </devices>
+ </domain>
+__EOT__
+ }
+}
+
+print "</node>";
diff --git a/tests/guests/guests.xml.in b/tests/guests/guests.xml.in
deleted file mode 100644
index 8f7ac81..0000000
--- a/tests/guests/guests.xml.in
+++ /dev/null
@@ -1,282 +0,0 @@
-<!--
- 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' type='raw'/>
- <source file='@abs_builddir(a)/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' type='raw'/>
- <source file='@abs_builddir(a)/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' type='raw'/>
- <source file='@abs_builddir(a)/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' type='raw'/>
- <source file='@abs_builddir(a)/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' type='raw'/>
- <source file='@abs_builddir(a)/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' type='raw'/>
- <source file='@abs_builddir(a)/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' type='raw'/>
- <source file='@abs_builddir(a)/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' type='raw'/>
- <source file='@abs_builddir(a)/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' type='raw'/>
- <source file='@abs_builddir(a)/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' type='raw'/>
- <source file='@abs_builddir(a)/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' type='raw'/>
- <source file='@abs_builddir(a)/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' type='raw'/>
- <source file='@abs_builddir(a)/ubuntu.img'/>
- <target dev='vda' bus='virtio'/>
- </disk>
- </devices>
- </domain>
-
- <domain type='test'>
- <name>archlinux</name>
- <memory>1048576</memory>
- <os>
- <type>hvm</type>
- <boot dev='hd'/>
- </os>
- <devices>
- <disk type='file' device='disk'>
- <driver name='qemu' type='raw'/>
- <source file='@abs_builddir(a)/archlinux.img'/>
- <target dev='vda' bus='virtio'/>
- </disk>
- </devices>
- </domain>
-
- <domain type='test'>
- <name>coreos</name>
- <memory>1048576</memory>
- <os>
- <type>hvm</type>
- <boot dev='hd'/>
- </os>
- <devices>
- <disk type='file' device='disk'>
- <driver name='qemu' type='raw'/>
- <source file='@abs_builddir(a)/coreos.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' type='raw'/>
- <source file='@abs_builddir(a)/windows.img'/>
- <target dev='vda' bus='virtio'/>
- </disk>
- </devices>
- </domain>
-
-</node>
--
2.5.0