Some of the libvirt XMLs for tests refer to a generated phony disk
image, and so far the relative path used worked almost by chance.
(For each disk, the path to it was ../test-data/etc, and since the
overlay pointing to it is stored directly in $LIBGUESTFS_CACHEDIR,
which is $buildir/tmp, then the relative path was resolved.)
Instead, have configure place the right top-level directory in those
XMLs, so the full path points to the generated disks. This fixes the
tests for at least two cases:
- we change the place where the temporary overlays are stored
- in srcdir!=builddir builds
There is no functional change to the tests themselves.
---
.gitignore | 7 +++++++
configure.ac | 7 +++++++
tests/Makefile.am | 9 +--------
tests/rhbz1232192.sh | 2 +-
tests/{rhbz1232192.xml => rhbz1232192.xml.in} | 4 ++--
tests/test-v2v-cdrom.sh | 2 +-
tests/{test-v2v-cdrom.xml => test-v2v-cdrom.xml.in} | 4 ++--
tests/test-v2v-floppy.sh | 2 +-
tests/{test-v2v-floppy.xml => test-v2v-floppy.xml.in} | 4 ++--
tests/test-v2v-mac.sh | 2 +-
tests/{test-v2v-mac.xml => test-v2v-mac.xml.in} | 2 +-
tests/test-v2v-networks-and-bridges.sh | 2 +-
...-bridges.xml => test-v2v-networks-and-bridges.xml.in} | 2 +-
tests/test-v2v-print-source.sh | 2 +-
...v2v-print-source.xml => test-v2v-print-source.xml.in} | 2 +-
tests/test-v2v-sound.sh | 2 +-
tests/{test-v2v-sound.xml => test-v2v-sound.xml.in} | 2 +-
17 files changed, 32 insertions(+), 25 deletions(-)
rename tests/{rhbz1232192.xml => rhbz1232192.xml.in} (75%)
rename tests/{test-v2v-cdrom.xml => test-v2v-cdrom.xml.in} (89%)
rename tests/{test-v2v-floppy.xml => test-v2v-floppy.xml.in} (89%)
rename tests/{test-v2v-mac.xml => test-v2v-mac.xml.in} (96%)
rename tests/{test-v2v-networks-and-bridges.xml =>
test-v2v-networks-and-bridges.xml.in} (96%)
rename tests/{test-v2v-print-source.xml => test-v2v-print-source.xml.in} (90%)
rename tests/{test-v2v-sound.xml => test-v2v-sound.xml.in} (93%)
diff --git a/.gitignore b/.gitignore
index 0914ea9b..b504a4c2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -128,7 +128,14 @@ Makefile.in
/test-harness/stamp-virt-v2v-test-harness.pod
/test-harness/virt-v2v-test-harness.1
/tests/libvirt-is-version
+/tests/rhbz1232192.xml
+/tests/test-v2v-cdrom.xml
/tests/test-v2v-conversion-of-*.sh
+/tests/test-v2v-floppy.xml
+/tests/test-v2v-mac.xml
+/tests/test-v2v-networks-and-bridges.xml
+/tests/test-v2v-print-source.xml
+/tests/test-v2v-sound.xml
/tests/windows.vmdk
/v2v/.depend
/v2v/config.ml
diff --git a/configure.ac b/configure.ac
index 73cf2081..e8a3133a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -153,6 +153,13 @@ AC_CONFIG_FILES([Makefile
test-harness/Makefile
test-harness/META
tests/Makefile
+ tests/rhbz1232192.xml
+ tests/test-v2v-cdrom.xml
+ tests/test-v2v-floppy.xml
+ tests/test-v2v-mac.xml
+ tests/test-v2v-networks-and-bridges.xml
+ tests/test-v2v-print-source.xml
+ tests/test-v2v-sound.xml
v2v/Makefile
v2v/config.ml])
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 267e4454..4456dc4c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -177,11 +177,9 @@ EXTRA_DIST += \
test-v2v-bad-networks-and-bridges.sh \
test-v2v-cdrom.expected \
test-v2v-cdrom.sh \
- test-v2v-cdrom.xml \
test-v2v-copy-to-local.sh \
test-v2v-floppy.expected \
test-v2v-floppy.sh \
- test-v2v-floppy.xml \
test-v2v-i-disk.sh \
test-v2v-i-ova-as-root.ovf \
test-v2v-i-ova-as-root.sh \
@@ -232,8 +230,6 @@ EXTRA_DIST += \
test-v2v-machine-readable.sh \
test-v2v-mac-expected.xml \
test-v2v-mac.sh \
- test-v2v-mac.xml \
- test-v2v-networks-and-bridges-expected.xml \
test-v2v-networks-and-bridges.sh \
test-v2v-networks-and-bridges.xml \
test-v2v-no-copy.sh \
@@ -258,12 +254,9 @@ EXTRA_DIST += \
test-v2v-print-estimate.sh \
test-v2v-print-source.expected \
test-v2v-print-source.sh \
- test-v2v-print-source.xml \
test-v2v-conversion-of.sh \
test-v2v-sound.sh \
- test-v2v-sound.xml \
test-v2v-trim.sh \
test-v2v-virtio-win-iso.sh \
test-v2v-windows-conversion.sh \
- rhbz1232192.sh \
- rhbz1232192.xml
+ rhbz1232192.sh
diff --git a/tests/rhbz1232192.sh b/tests/rhbz1232192.sh
index 80f86003..2d4b342b 100755
--- a/tests/rhbz1232192.sh
+++ b/tests/rhbz1232192.sh
@@ -30,4 +30,4 @@ skip_unless_phony_guest blank-disk.img
export VIRT_TOOLS_DATA_DIR="$top_srcdir/test-data/fake-virt-tools"
-virt-v2v -i libvirtxml "$srcdir/rhbz1232192.xml" -o null --no-copy
+virt-v2v -i libvirtxml rhbz1232192.xml -o null --no-copy
diff --git a/tests/rhbz1232192.xml b/tests/rhbz1232192.xml.in
similarity index 75%
rename from tests/rhbz1232192.xml
rename to tests/rhbz1232192.xml.in
index 79f019d3..03eb3049 100644
--- a/tests/rhbz1232192.xml
+++ b/tests/rhbz1232192.xml.in
@@ -14,12 +14,12 @@
<devices>
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
- <source file='../test-data/phony-guests/windows.img'/>
+ <source
file='@abs_top_builddir(a)/test-data/phony-guests/windows.img'/>
<target dev='hda' bus='ide'/>
</disk>
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
- <source file='../test-data/phony-guests/blank-disk.img'/>
+ <source
file='@abs_top_builddir(a)/test-data/phony-guests/blank-disk.img'/>
<target dev='hdb' bus='ide'/>
</disk>
</devices>
diff --git a/tests/test-v2v-cdrom.sh b/tests/test-v2v-cdrom.sh
index 8adc5103..9915f8ac 100755
--- a/tests/test-v2v-cdrom.sh
+++ b/tests/test-v2v-cdrom.sh
@@ -27,7 +27,7 @@ skip_if_backend uml
skip_unless_phony_guest windows.img
skip_unless_phony_guest blank-disk.img
-libvirt_uri="test://$abs_srcdir/test-v2v-cdrom.xml"
+libvirt_uri="test://$abs_builddir/test-v2v-cdrom.xml"
export VIRT_TOOLS_DATA_DIR="$top_srcdir/test-data/fake-virt-tools"
export VIRTIO_WIN="$top_srcdir/test-data/fake-virtio-win"
diff --git a/tests/test-v2v-cdrom.xml b/tests/test-v2v-cdrom.xml.in
similarity index 89%
rename from tests/test-v2v-cdrom.xml
rename to tests/test-v2v-cdrom.xml.in
index b0c29ebd..6bad5eab 100644
--- a/tests/test-v2v-cdrom.xml
+++ b/tests/test-v2v-cdrom.xml.in
@@ -27,14 +27,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
<devices>
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
- <source file='../test-data/phony-guests/windows.img'/>
+ <source
file='@abs_top_builddir(a)/test-data/phony-guests/windows.img'/>
<!-- virt-v2v should install virtio drivers and turn this
into dev='vda' bus='virtio' -->
<target dev='hda' bus='ide'/>
</disk>
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
- <source file='../test-data/phony-guests/blank-disk.img'/>
+ <source
file='@abs_top_builddir(a)/test-data/phony-guests/blank-disk.img'/>
<!-- virt-v2v should preserve the device name and bus -->
<target dev='hdc' bus='ide'/>
</disk>
diff --git a/tests/test-v2v-floppy.sh b/tests/test-v2v-floppy.sh
index 5855bb2e..07b9ac26 100755
--- a/tests/test-v2v-floppy.sh
+++ b/tests/test-v2v-floppy.sh
@@ -27,7 +27,7 @@ skip_if_backend uml
skip_unless_phony_guest windows.img
skip_unless_phony_guest blank-disk.img
-libvirt_uri="test://$abs_srcdir/test-v2v-floppy.xml"
+libvirt_uri="test://$abs_builddir/test-v2v-floppy.xml"
export VIRT_TOOLS_DATA_DIR="$top_srcdir/test-data/fake-virt-tools"
export VIRTIO_WIN="$top_srcdir/test-data/fake-virtio-win"
diff --git a/tests/test-v2v-floppy.xml b/tests/test-v2v-floppy.xml.in
similarity index 89%
rename from tests/test-v2v-floppy.xml
rename to tests/test-v2v-floppy.xml.in
index 5204432f..1a5c41a7 100644
--- a/tests/test-v2v-floppy.xml
+++ b/tests/test-v2v-floppy.xml.in
@@ -27,14 +27,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
<devices>
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
- <source file='../test-data/phony-guests/windows.img'/>
+ <source
file='@abs_top_builddir(a)/test-data/phony-guests/windows.img'/>
<!-- virt-v2v should install virtio drivers and turn this
into dev='vda' bus='virtio' -->
<target dev='hda' bus='ide'/>
</disk>
<disk type='file' device='floppy'>
<driver name='qemu' type='raw'/>
- <source file='../test-data/phony-guests/blank-disk.img'/>
+ <source
file='@abs_top_builddir(a)/test-data/phony-guests/blank-disk.img'/>
<target dev='fda' />
</disk>
</devices>
diff --git a/tests/test-v2v-mac.sh b/tests/test-v2v-mac.sh
index 9132fe2f..7e1d1047 100755
--- a/tests/test-v2v-mac.sh
+++ b/tests/test-v2v-mac.sh
@@ -25,7 +25,7 @@ skip_if_skipped
skip_if_backend uml
skip_unless_phony_guest windows.img
-libvirt_uri="test://$abs_srcdir/test-v2v-mac.xml"
+libvirt_uri="test://$abs_builddir/test-v2v-mac.xml"
f=$top_builddir/test-data/phony-guests/windows.img
export VIRT_TOOLS_DATA_DIR="$top_srcdir/test-data/fake-virt-tools"
diff --git a/tests/test-v2v-mac.xml b/tests/test-v2v-mac.xml.in
similarity index 96%
rename from tests/test-v2v-mac.xml
rename to tests/test-v2v-mac.xml.in
index c6f99219..28130b2c 100644
--- a/tests/test-v2v-mac.xml
+++ b/tests/test-v2v-mac.xml.in
@@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA.
<devices>
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
- <source file='../test-data/phony-guests/windows.img'/>
+ <source
file='@abs_top_builddir(a)/test-data/phony-guests/windows.img'/>
<target dev='vda' bus='virtio'/>
</disk>
diff --git a/tests/test-v2v-networks-and-bridges.sh
b/tests/test-v2v-networks-and-bridges.sh
index 74aea4da..0921926b 100755
--- a/tests/test-v2v-networks-and-bridges.sh
+++ b/tests/test-v2v-networks-and-bridges.sh
@@ -25,7 +25,7 @@ skip_if_skipped
skip_if_backend uml
skip_unless_phony_guest windows.img
-libvirt_uri="test://$abs_srcdir/test-v2v-networks-and-bridges.xml"
+libvirt_uri="test://$abs_builddir/test-v2v-networks-and-bridges.xml"
f=$top_builddir/test-data/phony-guests/windows.img
export VIRT_TOOLS_DATA_DIR="$top_srcdir/test-data/fake-virt-tools"
diff --git a/tests/test-v2v-networks-and-bridges.xml
b/tests/test-v2v-networks-and-bridges.xml.in
similarity index 96%
rename from tests/test-v2v-networks-and-bridges.xml
rename to tests/test-v2v-networks-and-bridges.xml.in
index 7a90747d..b99184fa 100644
--- a/tests/test-v2v-networks-and-bridges.xml
+++ b/tests/test-v2v-networks-and-bridges.xml.in
@@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA.
<devices>
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
- <source file='../test-data/phony-guests/windows.img'/>
+ <source
file='@abs_top_builddir(a)/test-data/phony-guests/windows.img'/>
<target dev='vda' bus='virtio'/>
</disk>
diff --git a/tests/test-v2v-print-source.sh b/tests/test-v2v-print-source.sh
index 70fc2d60..b6daafd2 100755
--- a/tests/test-v2v-print-source.sh
+++ b/tests/test-v2v-print-source.sh
@@ -29,7 +29,7 @@ rm -rf $d
mkdir $d
$VG virt-v2v --debug-gc \
- -i libvirtxml "$srcdir/test-v2v-print-source.xml" \
+ -i libvirtxml test-v2v-print-source.xml \
-o local -os $d \
--print-source > $d/output
diff --git a/tests/test-v2v-print-source.xml b/tests/test-v2v-print-source.xml.in
similarity index 90%
rename from tests/test-v2v-print-source.xml
rename to tests/test-v2v-print-source.xml.in
index 3768caf4..2f83fc73 100644
--- a/tests/test-v2v-print-source.xml
+++ b/tests/test-v2v-print-source.xml.in
@@ -18,7 +18,7 @@
<devices>
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
- <source file='../test-data/phony-guests/windows.img'/>
+ <source
file='@abs_top_builddir(a)/test-data/phony-guests/windows.img'/>
<target dev='vda' bus='virtio'/>
</disk>
<interface type='network'>
diff --git a/tests/test-v2v-sound.sh b/tests/test-v2v-sound.sh
index b8e2ab78..c31b4c46 100755
--- a/tests/test-v2v-sound.sh
+++ b/tests/test-v2v-sound.sh
@@ -25,7 +25,7 @@ skip_if_skipped
skip_if_backend uml
skip_unless_phony_guest windows.img
-libvirt_uri="test://$abs_srcdir/test-v2v-sound.xml"
+libvirt_uri="test://$abs_builddir/test-v2v-sound.xml"
f=$top_builddir/test-data/phony-guests/windows.img
export VIRT_TOOLS_DATA_DIR="$top_srcdir/test-data/fake-virt-tools"
diff --git a/tests/test-v2v-sound.xml b/tests/test-v2v-sound.xml.in
similarity index 93%
rename from tests/test-v2v-sound.xml
rename to tests/test-v2v-sound.xml.in
index 44e67cbc..18f011eb 100644
--- a/tests/test-v2v-sound.xml
+++ b/tests/test-v2v-sound.xml.in
@@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA.
<devices>
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
- <source file='../test-data/phony-guests/windows.img'/>
+ <source
file='@abs_top_builddir(a)/test-data/phony-guests/windows.img'/>
<target dev='vda' bus='virtio'/>
</disk>
<sound model="ich9"/>
--
2.25.1