---
.gitignore | 4 +-
builder/Makefile.am | 32 ++----
builder/test-virt-builder-list.sh | 2 -
builder/test-virt-builder.sh | 22 ++--
builder/test-virt-index-validate.sh | 8 +-
builder/tests.mk | 82 +++++++++++++++
builder/website/Makefile.am | 9 +-
builder/website/tests.mk | 67 ++++++++++++
configure.ac | 2 +
customize/Makefile.am | 16 +--
customize/test-virt-customize.sh | 2 +-
customize/tests.mk | 60 +++++++++++
generator/tests.ml | 146 +++++++++++++++++++++++++++
mllib/Makefile.am | 17 +---
mllib/tests.mk | 64 ++++++++++++
resize/Makefile.am | 16 +--
resize/tests.mk | 60 +++++++++++
sparsify/Makefile.am | 17 +---
sparsify/test-virt-sparsify-in-place.sh | 5 -
sparsify/tests.mk | 61 +++++++++++
sysprep/Makefile.am | 28 +----
sysprep/script1.sh | 2 +-
sysprep/script2.sh | 2 +-
sysprep/script4.sh | 2 +-
sysprep/test-virt-sysprep-local-guests.sh.in | 24 +++++
sysprep/test-virt-sysprep-passwords.sh | 4 +-
sysprep/test-virt-sysprep-script.sh | 13 +--
sysprep/test-virt-sysprep.sh | 5 -
sysprep/tests.mk | 73 ++++++++++++++
v2v/Makefile.am | 120 +++++-----------------
v2v/test-v2v-cdrom.sh | 58 +++++++----
v2v/test-v2v-cdrom.xml | 43 --------
v2v/test-v2v-i-disk.sh | 7 +-
v2v/test-v2v-i-ova-formats.sh | 15 +--
v2v/test-v2v-i-ova-gz.sh | 9 +-
v2v/test-v2v-i-ova-two-disks.sh | 9 +-
v2v/test-v2v-i-ova.sh | 11 +-
v2v/test-v2v-machine-readable.sh | 5 -
v2v/test-v2v-networks-and-bridges.sh | 96 ++++++++++++++----
v2v/test-v2v-networks-and-bridges.xml | 85 ----------------
v2v/test-v2v-no-copy.sh | 36 +++----
v2v/test-v2v-o-glance.sh | 11 +-
v2v/test-v2v-o-libvirt.sh | 19 +---
v2v/test-v2v-o-null.sh | 10 +-
v2v/test-v2v-o-qemu.sh | 8 +-
v2v/test-v2v-o-rhev.sh | 30 ++----
v2v/test-v2v-o-vdsm-options.sh | 38 +++----
v2v/test-v2v-of-option.sh | 20 +---
v2v/test-v2v-on-option.sh | 22 +---
v2v/test-v2v-print-source.sh | 30 ++----
v2v/test-v2v-real-conversions.sh | 43 ++++----
v2v/test-v2v-sound.sh | 43 ++++----
v2v/test-v2v-sound.xml | 36 -------
v2v/test-v2v-windows-conversion.sh | 24 ++---
v2v/tests.mk | 101 ++++++++++++++++++
55 files changed, 1060 insertions(+), 714 deletions(-)
create mode 100644 builder/tests.mk
create mode 100644 builder/website/tests.mk
create mode 100644 customize/tests.mk
create mode 100644 mllib/tests.mk
create mode 100644 resize/tests.mk
create mode 100644 sparsify/tests.mk
create mode 100755 sysprep/test-virt-sysprep-local-guests.sh.in
create mode 100644 sysprep/tests.mk
delete mode 100644 v2v/test-v2v-cdrom.xml
delete mode 100644 v2v/test-v2v-networks-and-bridges.xml
delete mode 100644 v2v/test-v2v-sound.xml
create mode 100644 v2v/tests.mk
diff --git a/.gitignore b/.gitignore
index 244d025..8f48e9e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -487,12 +487,10 @@ Makefile.in
/stamp-guestfs-release-notes.pod
/stamp-h1
/sysprep/.depend
-/sysprep/stamp-script1.sh
-/sysprep/stamp-script2.sh
-/sysprep/stamp-script4.sh
/sysprep/stamp-virt-sysprep.pod
/sysprep/sysprep-extra-options.pod
/sysprep/sysprep-operations.pod
+/sysprep/test-virt-sysprep-local-guests.sh
/sysprep/virt-sysprep
/sysprep/virt-sysprep.1
/test.err
diff --git a/builder/Makefile.am b/builder/Makefile.am
index f48efb0..aa74c3d 100644
--- a/builder/Makefile.am
+++ b/builder/Makefile.am
@@ -15,10 +15,12 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-include $(top_srcdir)/subdir-rules.mk
-
AM_YFLAGS = -d
+include $(top_srcdir)/subdir-rules.mk
+
+generator_built = tests.mk
+
EXTRA_DIST = \
$(SOURCES_MLI) $(SOURCES_ML) $(SOURCES_C) \
libguestfs.gpg \
@@ -205,18 +207,10 @@ stamp-virt-builder.pod: virt-builder.pod
$(top_srcdir)/customize/customize-synop
CLEANFILES += stamp-virt-builder.pod
-# Tests.
-
-TESTS_ENVIRONMENT = $(top_builddir)/run --test
-
-disk_images := \
- $(shell for f in debian fedora ubuntu windows; do if [ -s
"../tests/guests/$$f.img" ]; then echo $$f.xz; fi; done) \
- $(shell if [ -s "../tests/guests/fedora.img" ]; then echo fedora.qcow2
fedora.qcow2.xz; fi)
+# Disk images for tests.
CLEANFILES += *.qcow2 *.xz
-check_DATA = $(disk_images)
-
fedora.qcow2: ../tests/guests/fedora.img
rm -f $@ $@-t
qemu-img convert -f raw -O qcow2 $< $@-t
@@ -232,20 +226,6 @@ fedora.qcow2.xz: fedora.qcow2
xz --best -c $< > $@-t
mv $@-t $@
-TESTS = \
- test-virt-builder-list.sh \
- test-virt-index-validate.sh
-
-if ENABLE_APPLIANCE
-TESTS += test-virt-builder.sh
-endif ENABLE_APPLIANCE
-
-check-valgrind:
- $(MAKE) VG="$(top_builddir)/run @VG@" check
-
-check-slow:
- $(MAKE) TESTS="test-virt-builder-planner.sh" check
-
# Dependencies.
depend: .depend
@@ -330,3 +310,5 @@ endif
# in the distribution, so just remove them from the distdir.
dist-hook:
rm -f $(distdir)/index-parse.c $(distdir)/index-parse.h $(distdir)/index-scan.c
+
+include $(srcdir)/tests.mk
diff --git a/builder/test-virt-builder-list.sh b/builder/test-virt-builder-list.sh
index 2b6dfad..e42e3ec 100755
--- a/builder/test-virt-builder-list.sh
+++ b/builder/test-virt-builder-list.sh
@@ -21,8 +21,6 @@
export LANG=C
set -e
-abs_builddir=$(pwd)
-
export XDG_CONFIG_HOME=
export XDG_CONFIG_DIRS="$abs_builddir/test-config"
diff --git a/builder/test-virt-builder.sh b/builder/test-virt-builder.sh
index f357d12..c6e99c4 100755
--- a/builder/test-virt-builder.sh
+++ b/builder/test-virt-builder.sh
@@ -19,17 +19,10 @@
export LANG=C
set -e
-abs_builddir=$(pwd)
-
export XDG_CONFIG_HOME=
export XDG_CONFIG_DIRS="$abs_builddir/test-config"
-if [ -n "$SKIP_TEST_VIRT_BUILDER_SH" ]; then
- echo "$0: skipping test because environment variable is set."
- exit 77
-fi
-
-if [ ! -f fedora.xz ]; then
+if [ ! -f $builddir/fedora.xz ]; then
echo "$0: test skipped because there is no fedora.xz in the build
directory"
exit 77
fi
@@ -64,19 +57,20 @@ $VG virt-builder phony-fedora \
--root-password password:123456 \
--mkdir /etc/foo/bar/baz \
--write '/etc/foo/bar/baz/foo:Hello World' \
- --upload Makefile:/Makefile \
- --edit '/Makefile: s{^#.*}{}' \
- --upload Makefile:/etc/foo/bar/baz \
- --delete /Makefile \
+ --upload $srcdir/test-virt-builder.sh:/test \
+ --edit '/test: s{^#.*}{}' \
+ --upload $srcdir/test-virt-builder.sh:/etc/foo/bar/baz \
+ --delete /test \
--link /etc/foo/bar/baz/foo:/foo \
--link /etc/foo/bar/baz/foo:/foo1:/foo2:/foo3 \
- --firstboot Makefile --firstboot-command 'echo "hello"' \
+ --firstboot $srcdir/test-virt-builder.sh \
+ --firstboot-command 'echo "hello"' \
--firstboot-install "minicom,inkscape"
# Check that some modifications were made.
$VG guestfish --ro -i -a $output > test.out <<EOF
# Uploaded files
-is-file /etc/foo/bar/baz/Makefile
+is-file /etc/foo/bar/baz/test-virt-builder.sh
cat /etc/foo/bar/baz/foo
is-symlink /foo
is-symlink /foo1
diff --git a/builder/test-virt-index-validate.sh b/builder/test-virt-index-validate.sh
index b00a086..0e65591 100755
--- a/builder/test-virt-index-validate.sh
+++ b/builder/test-virt-index-validate.sh
@@ -19,7 +19,7 @@
export LANG=C
set -e
-! $VG virt-index-validate test-virt-index-validate-bad-1
-$VG virt-index-validate test-virt-index-validate-good-1
-$VG virt-index-validate test-virt-index-validate-good-2
-$VG virt-index-validate test-virt-index-validate-good-3
+! $VG virt-index-validate $srcdir/test-virt-index-validate-bad-1
+$VG virt-index-validate $srcdir/test-virt-index-validate-good-1
+$VG virt-index-validate $srcdir/test-virt-index-validate-good-2
+$VG virt-index-validate $srcdir/test-virt-index-validate-good-3
diff --git a/builder/tests.mk b/builder/tests.mk
new file mode 100644
index 0000000..d4efad0
--- /dev/null
+++ b/builder/tests.mk
@@ -0,0 +1,82 @@
+# libguestfs generated file
+# WARNING: THIS FILE IS GENERATED FROM:
+# generator/ *.ml
+# ANY CHANGES YOU MAKE TO THIS FILE WILL BE LOST.
+#
+# Copyright (C) 2009-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.
+
+localtestsdir = $(alltestsdir)/builder
+
+localtests_DATA = \
+ debian.xz \
+ fedora.qcow2 \
+ fedora.qcow2.xz \
+ fedora.xz \
+ ubuntu.xz \
+ windows.xz \
+ test-index \
+ test-virt-index-validate-bad-1 \
+ test-virt-index-validate-good-1 \
+ test-virt-index-validate-good-2 \
+ test-virt-index-validate-good-3
+
+localtests_SCRIPTS = \
+ test-virt-builder-list.sh \
+ test-virt-builder-planner.sh \
+ test-virt-builder.sh \
+ test-virt-index-validate.sh
+
+# Note that we cannot create a simple 'check:' target since
+# automake will (silently) overrule it, so we do this instead:
+
+TESTS_ENVIRONMENT = $(top_builddir)/run
+TESTS = $(top_builddir)/test-harness
+
+check-valgrind:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind
+
+check-direct:
+ $(top_builddir)/run $(top_builddir)/test-harness --direct
+
+check-valgrind-direct:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind --direct
+
+check-libvirt:
+ $(top_builddir)/run $(top_builddir)/test-harness --libvirt
+
+check-valgrind-libvirt:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind --libvirt
+
+check-uml:
+ $(top_builddir)/run $(top_builddir)/test-harness --uml
+
+check-valgrind-uml:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind --uml
+
+check-with-upstream-qemu:
+ $(top_builddir)/run $(top_builddir)/test-harness --upstream-qemu
+
+check-with-upstream-libvirt:
+ $(top_builddir)/run $(top_builddir)/test-harness --upstream-libvirt
+
+check-fast:
+ $(top_builddir)/run $(top_builddir)/test-harness --fast
+
+check-slow:
+ $(top_builddir)/run $(top_builddir)/test-harness --slow
+
+EXTRA_DIST += tests.mk
diff --git a/builder/website/Makefile.am b/builder/website/Makefile.am
index 4a65156..1c2c0da 100644
--- a/builder/website/Makefile.am
+++ b/builder/website/Makefile.am
@@ -17,6 +17,8 @@
include $(top_srcdir)/subdir-rules.mk
+generator_built = tests.mk
+
EXTRA_DIST = \
.gitignore \
compress.sh \
@@ -42,9 +44,4 @@ EXTRA_DIST = \
CLEANFILES = *~
-# Validates the index file.
-TESTS_ENVIRONMENT = $(top_builddir)/run --test
-TESTS = validate.sh
-
-check-valgrind:
- $(MAKE) VG="$(top_builddir)/run @VG@" check
+include $(srcdir)/tests.mk
diff --git a/builder/website/tests.mk b/builder/website/tests.mk
new file mode 100644
index 0000000..0f716a7
--- /dev/null
+++ b/builder/website/tests.mk
@@ -0,0 +1,67 @@
+# libguestfs generated file
+# WARNING: THIS FILE IS GENERATED FROM:
+# generator/ *.ml
+# ANY CHANGES YOU MAKE TO THIS FILE WILL BE LOST.
+#
+# Copyright (C) 2009-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.
+
+localtestsdir = $(alltestsdir)/builder/website
+
+localtests_DATA = \
+ index \
+ index.asc
+
+localtests_SCRIPTS = \
+ validate.sh
+
+# Note that we cannot create a simple 'check:' target since
+# automake will (silently) overrule it, so we do this instead:
+
+TESTS_ENVIRONMENT = $(top_builddir)/run
+TESTS = $(top_builddir)/test-harness
+
+check-valgrind:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind
+
+check-direct:
+ $(top_builddir)/run $(top_builddir)/test-harness --direct
+
+check-valgrind-direct:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind --direct
+
+check-libvirt:
+ $(top_builddir)/run $(top_builddir)/test-harness --libvirt
+
+check-valgrind-libvirt:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind --libvirt
+
+check-uml:
+ $(top_builddir)/run $(top_builddir)/test-harness --uml
+
+check-valgrind-uml:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind --uml
+
+check-with-upstream-qemu:
+ $(top_builddir)/run $(top_builddir)/test-harness --upstream-qemu
+
+check-with-upstream-libvirt:
+ $(top_builddir)/run $(top_builddir)/test-harness --upstream-libvirt
+
+check-fast:
+ $(top_builddir)/run $(top_builddir)/test-harness --fast
+
+EXTRA_DIST += tests.mk
diff --git a/configure.ac b/configure.ac
index a8e2586..cd075dd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1718,6 +1718,8 @@ AC_CONFIG_FILES([podwrapper.pl],
[chmod +x,-w podwrapper.pl])
AC_CONFIG_FILES([run],
[chmod +x,-w run])
+AC_CONFIG_FILES([sysprep/test-virt-sysprep-local-guests.sh],
+ [chmod +x,-w cat/test-virt-sysprep-local-guests.sh])
AC_CONFIG_FILES([Makefile
align/Makefile
diff --git a/customize/Makefile.am b/customize/Makefile.am
index 6e876a4..f213604 100644
--- a/customize/Makefile.am
+++ b/customize/Makefile.am
@@ -31,7 +31,8 @@ generator_built = \
customize_cmdline.mli \
customize_cmdline.ml \
customize-options.pod \
- customize-synopsis.pod
+ customize-synopsis.pod \
+ tests.mk
SOURCES_MLI = \
crypt.mli \
@@ -163,17 +164,6 @@ stamp-virt-customize.pod: virt-customize.pod
$(top_srcdir)/customize/customize-s
$<
touch $@
-# Tests.
-
-TESTS_ENVIRONMENT = $(top_builddir)/run --test
-
-if ENABLE_APPLIANCE
-TESTS = test-virt-customize.sh
-endif
-
-check-valgrind:
- $(MAKE) VG="$(top_builddir)/run @VG@" check
-
# Dependencies.
depend: .depend
@@ -193,3 +183,5 @@ endif
DISTCLEANFILES = .depend
.PHONY: depend docs
+
+include $(srcdir)/tests.mk
diff --git a/customize/test-virt-customize.sh b/customize/test-virt-customize.sh
index 979e6f0..2d17a67 100755
--- a/customize/test-virt-customize.sh
+++ b/customize/test-virt-customize.sh
@@ -22,7 +22,7 @@ set -e
# virt-customize with the -n option doesn't modify the guest. It ought
# to be able to customize any of our Linux-like test guests.
-for f in ../tests/guests/{debian,fedora,ubuntu}.img; do
+for f in $phonydir/{debian,fedora,ubuntu}.img; do
# Ignore zero-sized windows.img if ntfs-3g is not installed.
if [ -s "$f" ]; then
# Add --no-network so UML works.
diff --git a/customize/tests.mk b/customize/tests.mk
new file mode 100644
index 0000000..f79c51b
--- /dev/null
+++ b/customize/tests.mk
@@ -0,0 +1,60 @@
+# libguestfs generated file
+# WARNING: THIS FILE IS GENERATED FROM:
+# generator/ *.ml
+# ANY CHANGES YOU MAKE TO THIS FILE WILL BE LOST.
+#
+# Copyright (C) 2009-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.
+
+localtestsdir = $(alltestsdir)/customize
+
+localtests_SCRIPTS = \
+ test-virt-customize.sh
+
+# Note that we cannot create a simple 'check:' target since
+# automake will (silently) overrule it, so we do this instead:
+
+TESTS_ENVIRONMENT = $(top_builddir)/run
+TESTS = $(top_builddir)/test-harness
+
+check-valgrind:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind
+
+check-direct:
+ $(top_builddir)/run $(top_builddir)/test-harness --direct
+
+check-valgrind-direct:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind --direct
+
+check-libvirt:
+ $(top_builddir)/run $(top_builddir)/test-harness --libvirt
+
+check-valgrind-libvirt:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind --libvirt
+
+check-uml:
+ $(top_builddir)/run $(top_builddir)/test-harness --uml
+
+check-valgrind-uml:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind --uml
+
+check-with-upstream-qemu:
+ $(top_builddir)/run $(top_builddir)/test-harness --upstream-qemu
+
+check-with-upstream-libvirt:
+ $(top_builddir)/run $(top_builddir)/test-harness --upstream-libvirt
+
+EXTRA_DIST += tests.mk
diff --git a/generator/tests.ml b/generator/tests.ml
index 4ed53e8..3b72fd8 100644
--- a/generator/tests.ml
+++ b/generator/tests.ml
@@ -516,4 +516,150 @@ let tests = [
];
};
+ (* Test tools written in OCaml. *)
+
+ "mllib", {
+ defaults with
+ check_fast = [
+ "common_utils_tests";
+ "JSON_tests";
+ ];
+ };
+
+ "customize", {
+ defaults with
+ check = [
+ "test-virt-customize.sh"
+ ];
+ };
+
+ "builder", {
+ defaults with
+ check_fast = [
+ "test-virt-builder-list.sh";
+ "test-virt-index-validate.sh"
+ ];
+ check = [
+ "test-virt-builder.sh"
+ ];
+ check_slow = [
+ "test-virt-builder-planner.sh"
+ ];
+ check_data = [
+ "debian.xz";
+ "fedora.xz";
+ "ubuntu.xz";
+ "windows.xz";
+ "fedora.qcow2";
+ "fedora.qcow2.xz";
+ "test-index";
+ "test-virt-index-validate-bad-1";
+ "test-virt-index-validate-good-1";
+ "test-virt-index-validate-good-2";
+ "test-virt-index-validate-good-3";
+ ];
+ };
+
+ "builder/website", {
+ defaults with
+ check_fast = [
+ "validate.sh"
+ ];
+ check_data = [
+ "index";
+ "index.asc"
+ ];
+ };
+
+ "resize", {
+ defaults with
+ check = [
+ "test-virt-resize.pl"
+ ];
+ };
+
+ "sparsify", {
+ defaults with
+ check = [
+ "test-virt-sparsify.sh";
+ "test-virt-sparsify-in-place.sh";
+ ];
+ };
+
+ "sysprep", {
+ defaults with
+ check = [
+ "test-virt-sysprep.sh";
+ "test-virt-sysprep-passwords.sh";
+ "test-virt-sysprep-script.sh";
+ ];
+ check_local_guests = [
+ "test-virt-sysprep-local-guests.sh";
+ ];
+ check_scripts = [
+ "script1.sh";
+ "script2.sh";
+ "script3.sh";
+ "script4.sh"
+ ];
+ };
+
+ (* The virt-v2v tests here are not meant to be thorough tests of guest
+ * conversion. There is a test suite used to test conversion which is
+ * kept outside libguestfs because it contains lots of proprietary
+ * unredistributable guests like Windows.
+ *
+ * The tests here instead are testing:
+ *
+ * - virt-v2v command line arguments
+ * - virt-v2v reads and writes files to the correct places
+ * - valgrind & memory leaks
+ * - any conversion properties that can be tested using just the
+ * phony guests (but we don't go out of our way here)
+ * - that up to date guests don't crash virt-v2v
+ *)
+ "v2v", {
+ defaults with
+ check_fast = [
+ "test-v2v-i-ova-formats.sh";
+ "test-v2v-i-ova-gz.sh";
+ "test-v2v-i-ova-two-disks.sh";
+ "v2v_unit_tests";
+ ];
+ check = [
+ "test-v2v-cdrom.sh";
+ "test-v2v-i-ova.sh";
+ "test-v2v-i-disk.sh";
+ "test-v2v-machine-readable.sh";
+ "test-v2v-networks-and-bridges.sh";
+ "test-v2v-no-copy.sh";
+ "test-v2v-o-glance.sh";
+ "test-v2v-o-libvirt.sh";
+ "test-v2v-o-null.sh";
+ "test-v2v-o-qemu.sh";
+ "test-v2v-o-rhev.sh";
+ "test-v2v-o-vdsm-options.sh";
+ "test-v2v-of-option.sh";
+ "test-v2v-on-option.sh";
+ "test-v2v-print-source.sh";
+ "test-v2v-sound.sh";
+ "test-v2v-windows-conversion.sh";
+ ];
+ check_slow = [
+ "test-v2v-real-conversions.sh";
+ ];
+ check_data = [
+ "test-v2v-cdrom.expected";
+ "test-v2v-i-ova.ovf";
+ "test-v2v-i-ova.xml";
+ "test-v2v-i-ova-formats.expected";
+ "test-v2v-i-ova-formats.ovf";
+ "test-v2v-i-ova-gz.expected";
+ "test-v2v-i-ova-gz.ovf";
+ "test-v2v-i-ova-two-disks.expected";
+ "test-v2v-i-ova-two-disks.ovf";
+ "test-v2v-networks-and-bridges-expected.xml";
+ ];
+ };
+
]
diff --git a/mllib/Makefile.am b/mllib/Makefile.am
index 39f1b33..3dfa2fb 100644
--- a/mllib/Makefile.am
+++ b/mllib/Makefile.am
@@ -17,6 +17,8 @@
include $(top_srcdir)/subdir-rules.mk
+generator_built = tests.mk
+
EXTRA_DIST = \
$(SOURCES_MLI) \
$(filter-out config.ml libdir.ml,$(SOURCES_ML)) \
@@ -182,21 +184,8 @@ JSON_tests_LINK = \
$(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLPACKAGES_TESTS)
$(OCAMLLINKFLAGS) \
$(JSON_tests_THEOBJECTS) -o $@
-TESTS_ENVIRONMENT = $(top_builddir)/run --test
-
-TESTS =
-check_PROGRAMS =
-
-if HAVE_OCAML_PKG_OUNIT
-check_PROGRAMS += common_utils_tests JSON_tests
-TESTS += common_utils_tests JSON_tests
-endif
-
CLEANFILES += oUnit-*
-check-valgrind:
- $(MAKE) VG="$(top_builddir)/run @VG@" check
-
# Dependencies.
depend: .depend
@@ -216,3 +205,5 @@ endif
DISTCLEANFILES = .depend
.PHONY: depend docs
+
+include $(srcdir)/tests.mk
diff --git a/mllib/tests.mk b/mllib/tests.mk
new file mode 100644
index 0000000..0ae0029
--- /dev/null
+++ b/mllib/tests.mk
@@ -0,0 +1,64 @@
+# libguestfs generated file
+# WARNING: THIS FILE IS GENERATED FROM:
+# generator/ *.ml
+# ANY CHANGES YOU MAKE TO THIS FILE WILL BE LOST.
+#
+# Copyright (C) 2009-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.
+
+localtestsdir = $(alltestsdir)/mllib
+
+localtests_PROGRAMS = \
+ JSON_tests \
+ common_utils_tests
+
+# Note that we cannot create a simple 'check:' target since
+# automake will (silently) overrule it, so we do this instead:
+
+TESTS_ENVIRONMENT = $(top_builddir)/run
+TESTS = $(top_builddir)/test-harness
+
+check-valgrind:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind
+
+check-direct:
+ $(top_builddir)/run $(top_builddir)/test-harness --direct
+
+check-valgrind-direct:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind --direct
+
+check-libvirt:
+ $(top_builddir)/run $(top_builddir)/test-harness --libvirt
+
+check-valgrind-libvirt:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind --libvirt
+
+check-uml:
+ $(top_builddir)/run $(top_builddir)/test-harness --uml
+
+check-valgrind-uml:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind --uml
+
+check-with-upstream-qemu:
+ $(top_builddir)/run $(top_builddir)/test-harness --upstream-qemu
+
+check-with-upstream-libvirt:
+ $(top_builddir)/run $(top_builddir)/test-harness --upstream-libvirt
+
+check-fast:
+ $(top_builddir)/run $(top_builddir)/test-harness --fast
+
+EXTRA_DIST += tests.mk
diff --git a/resize/Makefile.am b/resize/Makefile.am
index d142288..3a23d9a 100644
--- a/resize/Makefile.am
+++ b/resize/Makefile.am
@@ -17,6 +17,8 @@
include $(top_srcdir)/subdir-rules.mk
+generator_built = tests.mk
+
EXTRA_DIST = \
$(SOURCES_MLI) $(SOURCES_ML) $(SOURCES_C) \
virt-resize.pod \
@@ -127,18 +129,6 @@ stamp-virt-resize.pod: virt-resize.pod
CLEANFILES += stamp-virt-resize.pod
-# Tests.
-
-TESTS_ENVIRONMENT = $(top_builddir)/run --test
-
-TESTS =
-if ENABLE_APPLIANCE
-TESTS += test-virt-resize.pl
-endif
-
-check-valgrind:
- $(MAKE) VG="$(top_builddir)/run @VG@" check
-
# Dependencies.
depend: .depend
@@ -158,3 +148,5 @@ endif
DISTCLEANFILES = .depend
.PHONY: depend docs
+
+include $(srcdir)/tests.mk
diff --git a/resize/tests.mk b/resize/tests.mk
new file mode 100644
index 0000000..88dd8e0
--- /dev/null
+++ b/resize/tests.mk
@@ -0,0 +1,60 @@
+# libguestfs generated file
+# WARNING: THIS FILE IS GENERATED FROM:
+# generator/ *.ml
+# ANY CHANGES YOU MAKE TO THIS FILE WILL BE LOST.
+#
+# Copyright (C) 2009-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.
+
+localtestsdir = $(alltestsdir)/resize
+
+localtests_SCRIPTS = \
+ test-virt-resize.pl
+
+# Note that we cannot create a simple 'check:' target since
+# automake will (silently) overrule it, so we do this instead:
+
+TESTS_ENVIRONMENT = $(top_builddir)/run
+TESTS = $(top_builddir)/test-harness
+
+check-valgrind:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind
+
+check-direct:
+ $(top_builddir)/run $(top_builddir)/test-harness --direct
+
+check-valgrind-direct:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind --direct
+
+check-libvirt:
+ $(top_builddir)/run $(top_builddir)/test-harness --libvirt
+
+check-valgrind-libvirt:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind --libvirt
+
+check-uml:
+ $(top_builddir)/run $(top_builddir)/test-harness --uml
+
+check-valgrind-uml:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind --uml
+
+check-with-upstream-qemu:
+ $(top_builddir)/run $(top_builddir)/test-harness --upstream-qemu
+
+check-with-upstream-libvirt:
+ $(top_builddir)/run $(top_builddir)/test-harness --upstream-libvirt
+
+EXTRA_DIST += tests.mk
diff --git a/sparsify/Makefile.am b/sparsify/Makefile.am
index ab9af7a..1112c17 100644
--- a/sparsify/Makefile.am
+++ b/sparsify/Makefile.am
@@ -17,6 +17,8 @@
include $(top_srcdir)/subdir-rules.mk
+generator_built = tests.mk
+
EXTRA_DIST = \
$(SOURCES_ML) $(SOURCES_C) \
virt-sparsify.pod \
@@ -120,19 +122,6 @@ stamp-virt-sparsify.pod: virt-sparsify.pod
CLEANFILES += stamp-virt-sparsify.pod
-# Tests.
-
-TESTS_ENVIRONMENT = $(top_builddir)/run --test
-
-if ENABLE_APPLIANCE
-TESTS = \
- test-virt-sparsify.sh \
- test-virt-sparsify-in-place.sh
-endif ENABLE_APPLIANCE
-
-check-valgrind:
- $(MAKE) VG="$(top_builddir)/run @VG@" check
-
# Dependencies.
depend: .depend
@@ -152,3 +141,5 @@ endif
DISTCLEANFILES = .depend
.PHONY: depend docs
+
+include $(srcdir)/tests.mk
diff --git a/sparsify/test-virt-sparsify-in-place.sh
b/sparsify/test-virt-sparsify-in-place.sh
index 64ead1a..0b86562 100755
--- a/sparsify/test-virt-sparsify-in-place.sh
+++ b/sparsify/test-virt-sparsify-in-place.sh
@@ -19,11 +19,6 @@
export LANG=C
set -e
-if [ -n "$SKIP_TEST_VIRT_SPARSIFY_IN_PLACE_SH" ]; then
- echo "$0: skipping test (environment variable set)"
- exit 77
-fi
-
if [ "$(guestfish get-backend)" = "uml" ]; then
echo "$0: skipping test because uml backend does not support discard"
exit 77
diff --git a/sparsify/tests.mk b/sparsify/tests.mk
new file mode 100644
index 0000000..f375c03
--- /dev/null
+++ b/sparsify/tests.mk
@@ -0,0 +1,61 @@
+# libguestfs generated file
+# WARNING: THIS FILE IS GENERATED FROM:
+# generator/ *.ml
+# ANY CHANGES YOU MAKE TO THIS FILE WILL BE LOST.
+#
+# Copyright (C) 2009-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.
+
+localtestsdir = $(alltestsdir)/sparsify
+
+localtests_SCRIPTS = \
+ test-virt-sparsify-in-place.sh \
+ test-virt-sparsify.sh
+
+# Note that we cannot create a simple 'check:' target since
+# automake will (silently) overrule it, so we do this instead:
+
+TESTS_ENVIRONMENT = $(top_builddir)/run
+TESTS = $(top_builddir)/test-harness
+
+check-valgrind:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind
+
+check-direct:
+ $(top_builddir)/run $(top_builddir)/test-harness --direct
+
+check-valgrind-direct:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind --direct
+
+check-libvirt:
+ $(top_builddir)/run $(top_builddir)/test-harness --libvirt
+
+check-valgrind-libvirt:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind --libvirt
+
+check-uml:
+ $(top_builddir)/run $(top_builddir)/test-harness --uml
+
+check-valgrind-uml:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind --uml
+
+check-with-upstream-qemu:
+ $(top_builddir)/run $(top_builddir)/test-harness --upstream-qemu
+
+check-with-upstream-libvirt:
+ $(top_builddir)/run $(top_builddir)/test-harness --upstream-libvirt
+
+EXTRA_DIST += tests.mk
diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am
index 1e30455..245cbdd 100644
--- a/sysprep/Makefile.am
+++ b/sysprep/Makefile.am
@@ -17,10 +17,13 @@
include $(top_srcdir)/subdir-rules.mk
+generator_built = tests.mk
+
EXTRA_DIST = \
$(SOURCES_MLI) $(SOURCES_ML) $(SOURCES_C) \
script1.sh script2.sh script3.sh script4.sh \
test-virt-sysprep.sh \
+ test-virt-sysprep-local-guests.sh \
test-virt-sysprep-passwords.sh \
test-virt-sysprep-script.sh \
virt-sysprep.pod
@@ -200,29 +203,6 @@ sysprep-operations.pod: virt-sysprep
$(top_builddir)/run ./$< --dump-pod > $@-t
mv $@-t $@
-# Tests.
-
-TESTS_ENVIRONMENT = \
- abs_builddir=$(abs_builddir) \
- abs_srcdir=$(abs_srcdir) \
- PATH=$(abs_top_builddir)/fuse:$(PATH) \
- $(top_builddir)/run --test
-
-if ENABLE_APPLIANCE
-TESTS = \
- test-virt-sysprep.sh \
- test-virt-sysprep-passwords.sh \
- test-virt-sysprep-script.sh
-endif ENABLE_APPLIANCE
-
-check-valgrind:
- $(MAKE) TESTS="test-virt-sysprep.sh" VG="$(top_builddir)/run @VG@"
check
-
-check-valgrind-local-guests:
- for g in $(GUESTS); do \
- $(top_builddir)/run --test @VG@ ./virt-sysprep -n -c "$(libvirt_ro_uri)" -d
"$$g" || exit $$?; \
- done
-
# Dependencies.
depend: .depend
@@ -242,3 +222,5 @@ endif
DISTCLEANFILES = .depend
.PHONY: depend docs
+
+include $(srcdir)/tests.mk
diff --git a/sysprep/script1.sh b/sysprep/script1.sh
index 6ba274c..8726a6f 100755
--- a/sysprep/script1.sh
+++ b/sysprep/script1.sh
@@ -18,4 +18,4 @@
# This is used by test-virt-sysprep-script.sh.
-pwd > $abs_builddir/stamp-script1.sh
+pwd > $tmpdir/stamp-script1.sh
diff --git a/sysprep/script2.sh b/sysprep/script2.sh
index a8ca21f..163f36e 100755
--- a/sysprep/script2.sh
+++ b/sysprep/script2.sh
@@ -20,4 +20,4 @@
rm -f etc/resolv.conf
-pwd > $abs_builddir/stamp-script2.sh
+pwd > $tmpdir/stamp-script2.sh
diff --git a/sysprep/script4.sh b/sysprep/script4.sh
index fe377e0..313ab85 100755
--- a/sysprep/script4.sh
+++ b/sysprep/script4.sh
@@ -18,4 +18,4 @@
# This is used by test-virt-sysprep-script.sh.
-pwd >> $abs_builddir/stamp-script4.sh
+pwd >> $tmpdir/stamp-script4.sh
diff --git a/sysprep/test-virt-sysprep-local-guests.sh.in
b/sysprep/test-virt-sysprep-local-guests.sh.in
new file mode 100755
index 0000000..36ef713
--- /dev/null
+++ b/sysprep/test-virt-sysprep-local-guests.sh.in
@@ -0,0 +1,24 @@
+#!/bin/bash -
+# libguestfs
+# Copyright (C) 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.
+
+export LANG=C
+set -e
+
+for g in "$@"; do
+ $VG virt-sysprep -n -c "@libvirt_ro_uri@" -d "$g"
+done
diff --git a/sysprep/test-virt-sysprep-passwords.sh
b/sysprep/test-virt-sysprep-passwords.sh
index b5189c8..74ae5e7 100755
--- a/sysprep/test-virt-sysprep-passwords.sh
+++ b/sysprep/test-virt-sysprep-passwords.sh
@@ -26,7 +26,7 @@ if [ "$(guestfish get-backend)" = "uml" ]; then
exit 77
fi
-if [ ! -s ../tests/guests/fedora.img ]; then
+if [ ! -s $phonydir/fedora.img ]; then
echo "$0: skipping test because there is no phony Fedora test image"
exit 77
fi
@@ -37,7 +37,7 @@ fi
rm -f passwords.qcow2 password
guestfish -- \
disk-create passwords.qcow2 qcow2 -1 \
- backingfile:../tests/guests/fedora.img backingformat:raw
+ backingfile:$phonydir/fedora.img backingformat:raw
guestfish -a passwords.qcow2 -i <<'EOF'
write-append /etc/shadow "test01::15677:0:99999:7:::\n"
diff --git a/sysprep/test-virt-sysprep-script.sh b/sysprep/test-virt-sysprep-script.sh
index 10ba1d1..0dbf964 100755
--- a/sysprep/test-virt-sysprep-script.sh
+++ b/sysprep/test-virt-sysprep-script.sh
@@ -20,11 +20,6 @@ export LANG=C
set -e
#set -x
-if [ -n "$SKIP_TEST_VIRT_SYSPREP_SCRIPT_SH" ]; then
- echo "$0: test skipped because environment variable is set."
- exit 77
-fi
-
if [ ! -w /dev/fuse ]; then
echo "$0: SKIPPING test, because there is no /dev/fuse."
exit 77
@@ -32,7 +27,7 @@ fi
# Check that multiple scripts can run.
rm -f stamp-script1.sh stamp-script2.sh stamp-script4.sh
-if ! virt-sysprep -q -n -a ../tests/guests/fedora.img --enable script \
+if ! virt-sysprep -q -n -a $phonydir/fedora.img --enable script \
--script $abs_srcdir/script1.sh --script $abs_srcdir/script2.sh; then
echo "$0: virt-sysprep wasn't expected to exit with error."
exit 1
@@ -43,19 +38,19 @@ if [ ! -f stamp-script1.sh -o ! -f stamp-script2.sh ]; then
fi
# Check that if a script fails, virt-sysprep exits with an error.
-if virt-sysprep -q -n -a ../tests/guests/fedora.img --enable script \
+if virt-sysprep -q -n -a $phonydir/fedora.img --enable script \
--script $abs_srcdir/script3.sh; then
echo "$0: virt-sysprep didn't exit with an error."
exit 1
fi
# Check that virt-sysprep uses a new temporary directory every time.
-if ! virt-sysprep -q -n -a ../tests/guests/fedora.img --enable script \
+if ! virt-sysprep -q -n -a $phonydir/fedora.img --enable script \
--script $abs_srcdir/script4.sh; then
echo "$0: virt-sysprep (script4.sh, try #1) wasn't expected to exit with
error."
exit 1
fi
-if ! virt-sysprep -q -n -a ../tests/guests/fedora.img --enable script \
+if ! virt-sysprep -q -n -a $phonydir/fedora.img --enable script \
--script $abs_srcdir/script4.sh; then
echo "$0: virt-sysprep (script4.sh, try #2) wasn't expected to exit with
error."
exit 1
diff --git a/sysprep/test-virt-sysprep.sh b/sysprep/test-virt-sysprep.sh
index 14cd492..7ec96d0 100755
--- a/sysprep/test-virt-sysprep.sh
+++ b/sysprep/test-virt-sysprep.sh
@@ -19,11 +19,6 @@
export LANG=C
set -e
-if [ -n "$SKIP_TEST_VIRT_SYSPREP_SH" ]; then
- echo "$0: test skipped because environment variable is set."
- exit 77
-fi
-
# Get a comma-separated list of the enabled-by-default operations.
operations=$(
virt-sysprep --list-operations |
diff --git a/sysprep/tests.mk b/sysprep/tests.mk
new file mode 100644
index 0000000..fb6cd49
--- /dev/null
+++ b/sysprep/tests.mk
@@ -0,0 +1,73 @@
+# libguestfs generated file
+# WARNING: THIS FILE IS GENERATED FROM:
+# generator/ *.ml
+# ANY CHANGES YOU MAKE TO THIS FILE WILL BE LOST.
+#
+# Copyright (C) 2009-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.
+
+localtestsdir = $(alltestsdir)/sysprep
+
+localtests_SCRIPTS = \
+ script1.sh \
+ script2.sh \
+ script3.sh \
+ script4.sh \
+ test-virt-sysprep-local-guests.sh \
+ test-virt-sysprep-passwords.sh \
+ test-virt-sysprep-script.sh \
+ test-virt-sysprep.sh
+
+# Note that we cannot create a simple 'check:' target since
+# automake will (silently) overrule it, so we do this instead:
+
+TESTS_ENVIRONMENT = $(top_builddir)/run
+TESTS = $(top_builddir)/test-harness
+
+check-valgrind:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind
+
+check-direct:
+ $(top_builddir)/run $(top_builddir)/test-harness --direct
+
+check-valgrind-direct:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind --direct
+
+check-libvirt:
+ $(top_builddir)/run $(top_builddir)/test-harness --libvirt
+
+check-valgrind-libvirt:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind --libvirt
+
+check-uml:
+ $(top_builddir)/run $(top_builddir)/test-harness --uml
+
+check-valgrind-uml:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind --uml
+
+check-with-upstream-qemu:
+ $(top_builddir)/run $(top_builddir)/test-harness --upstream-qemu
+
+check-with-upstream-libvirt:
+ $(top_builddir)/run $(top_builddir)/test-harness --upstream-libvirt
+
+check-local-guests:
+ $(top_builddir)/run $(top_builddir)/test-harness --local-guests
+
+check-valgrind-local-guests:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind --local-guests
+
+EXTRA_DIST += tests.mk
diff --git a/v2v/Makefile.am b/v2v/Makefile.am
index e957a15..a72c518 100644
--- a/v2v/Makefile.am
+++ b/v2v/Makefile.am
@@ -17,24 +17,43 @@
include $(top_srcdir)/subdir-rules.mk
+generator_built = tests.mk
+
EXTRA_DIST = \
$(SOURCES_MLI) $(SOURCES_ML) $(SOURCES_C) \
- v2v_unit_tests.ml \
- $(TESTS) $(SLOW_TESTS) \
HACKING \
+ v2v_unit_tests.ml \
test-v2v-cdrom.expected \
- test-v2v-cdrom.xml \
- test-v2v-i-ova.ovf \
- test-v2v-i-ova.xml \
+ test-v2v-cdrom.sh \
+ test-v2v-i-disk.sh \
test-v2v-i-ova-formats.expected \
test-v2v-i-ova-formats.ovf \
+ test-v2v-i-ova-formats.sh \
test-v2v-i-ova-gz.expected \
test-v2v-i-ova-gz.ovf \
+ test-v2v-i-ova-gz.sh \
test-v2v-i-ova-two-disks.expected \
test-v2v-i-ova-two-disks.ovf \
+ test-v2v-i-ova-two-disks.sh \
+ test-v2v-i-ova.ovf \
+ test-v2v-i-ova.sh \
+ test-v2v-i-ova.xml \
+ test-v2v-machine-readable.sh \
test-v2v-networks-and-bridges-expected.xml \
- test-v2v-networks-and-bridges.xml \
- test-v2v-sound.xml \
+ test-v2v-networks-and-bridges.sh \
+ test-v2v-no-copy.sh \
+ test-v2v-o-glance.sh \
+ test-v2v-o-libvirt.sh \
+ test-v2v-o-null.sh \
+ test-v2v-o-qemu.sh \
+ test-v2v-o-rhev.sh \
+ test-v2v-o-vdsm-options.sh \
+ test-v2v-of-option.sh \
+ test-v2v-on-option.sh \
+ test-v2v-print-source.sh \
+ test-v2v-real-conversions.sh \
+ test-v2v-sound.sh \
+ test-v2v-windows-conversion.sh \
virt-v2v.pod
CLEANFILES = *~ *.annot *.cmi *.cmo *.cmx *.cmxa *.o virt-v2v
@@ -200,92 +219,7 @@ stamp-virt-v2v.pod: virt-v2v.pod
CLEANFILES += stamp-virt-v2v.pod
-# Tests.
-
-# The virt-v2v tests here are not meant to be thorough tests of guest
-# conversion. There is a test suite used to test conversion which is
-# kept outside libguestfs because it contains lots of proprietary
-# unredistributable guests like Windows.
-#
-# The tests here instead are testing:
-#
-# - virt-v2v command line arguments
-# - virt-v2v reads and writes files to the correct places
-# - valgrind & memory leaks
-# - any conversion properties that can be tested using just the
-# phony guests (but we don't go out of our way here)
-# - that up to date guests don't crash virt-v2v
-
-TESTS_ENVIRONMENT = $(top_builddir)/run --test
-
-TESTS = \
- test-v2v-i-ova-formats.sh \
- test-v2v-i-ova-gz.sh \
- test-v2v-i-ova-two-disks.sh
-
-if HAVE_OCAML_PKG_OUNIT
-TESTS += v2v_unit_tests
-endif
-
-if ENABLE_APPLIANCE
-TESTS += \
- test-v2v-cdrom.sh \
- test-v2v-i-ova.sh \
- test-v2v-i-disk.sh \
- test-v2v-machine-readable.sh \
- test-v2v-networks-and-bridges.sh \
- test-v2v-no-copy.sh \
- test-v2v-o-glance.sh \
- test-v2v-o-libvirt.sh \
- test-v2v-o-null.sh \
- test-v2v-o-qemu.sh \
- test-v2v-o-rhev.sh \
- test-v2v-o-vdsm-options.sh \
- test-v2v-of-option.sh \
- test-v2v-on-option.sh \
- test-v2v-print-source.sh \
- test-v2v-sound.sh \
- test-v2v-windows-conversion.sh
-endif ENABLE_APPLIANCE
-
-check-valgrind:
- $(MAKE) VG="$(top_builddir)/run @VG@" check
-
-SLOW_TESTS = \
- test-v2v-real-conversions.sh
-
-check-slow: $(real_guests:%=%.img)
- $(MAKE) check TESTS="$(SLOW_TESTS)"
-
-# A selection of real guests that test-v2v-real-conversions.sh will
-# try to convert. This is only used by 'make check-slow'.
-
-real_guests = \
- centos-6 \
- centos-7.0 \
- fedora-20 \
- rhel-5.10 \
- rhel-6.5 \
- rhel-7.0
-
-$(real_guests:%=%.img):
- rm -f $@
- n=`basename $@ .img`; \
- vb="$(top_builddir)/run $(top_builddir)/builder/virt-builder"; \
- if $$vb --help >/dev/null && $$vb --notes $$n >/dev/null; then \
- $$vb $$n; \
- else \
- touch $$n.img; \
- fi
-
-CLEANFILES += $(real_guests:%=%.img)
-
# Unit tests.
-check_PROGRAMS =
-if HAVE_OCAML_PKG_OUNIT
-check_PROGRAMS += v2v_unit_tests
-endif
-
v2v_unit_tests_BOBJECTS = \
$(top_builddir)/mllib/config.cmo \
$(top_builddir)/mllib/common_gettext.cmo \
@@ -340,3 +274,5 @@ endif
DISTCLEANFILES = .depend
.PHONY: depend docs
+
+include $(srcdir)/tests.mk
diff --git a/v2v/test-v2v-cdrom.sh b/v2v/test-v2v-cdrom.sh
index 93975c2..1130e46 100755
--- a/v2v/test-v2v-cdrom.sh
+++ b/v2v/test-v2v-cdrom.sh
@@ -23,26 +23,18 @@ unset CDPATH
export LANG=C
set -e
-if [ -n "$SKIP_TEST_V2V_CDROM_SH" ]; then
- echo "$0: test skipped because environment variable is set"
- exit 77
-fi
-
if [ "$(guestfish get-backend)" = "uml" ]; then
echo "$0: test skipped because UML backend does not support network"
exit 77
fi
-abs_builddir="$(pwd)"
-libvirt_uri="test://$abs_builddir/test-v2v-cdrom.xml"
-
-f=../tests/guests/windows.img
+f=$phonydir/windows.img
if ! test -f $f || ! test -s $f; then
echo "$0: test skipped because phony Windows image was not created"
exit 77
fi
-f=../tests/guests/blank-disk.img
+f=$phonydir/blank-disk.img
if ! test -f $f || ! test -s $f; then
echo "$0: test skipped because blank-disk.img was not created"
exit 77
@@ -54,27 +46,51 @@ if ! test -r $virt_tools_data_dir/rhsrvany.exe; then
exit 77
fi
-d=test-v2v-cdrom.d
-rm -rf $d
-mkdir $d
+# Libvirt XML.
+echo > guest.xml <<EOF
+<node>
+ <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='$phonydir/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='$phonydir/blank-disk.img'/>
+ <!-- virt-v2v should preserve the device name and bus -->
+ <target dev='hdc' bus='ide'/>
+ </disk>
+ </devices>
+ </domain>
+</node>
+EOF
+libvirt_uri="test://$tmpdir/guest.xml"
$VG virt-v2v --debug-gc \
-i libvirt -ic "$libvirt_uri" windows \
- -o local -os $d --no-copy
+ -o local -os . --no-copy
# Test the libvirt XML metadata was created.
-test -f $d/windows.xml
+test -f windows.xml
# Grab just the <disk>..</disk> output and compare it to what we
# expect.
https://stackoverflow.com/questions/16587218
awk '/<disk /{p=1;print;next} p&&/<\/disk>/{p=0;print;next} ;p'
\
- $d/windows.xml |
- grep -v '<source file' > $d/disks
+ windows.xml |
+ grep -v '<source file' > disks
-if ! diff -u test-v2v-cdrom.expected $d/disks; then
+if ! diff -u $srcdir/test-v2v-cdrom.expected disks; then
echo "$0: unexpected disk assignments"
- cat $d/disks
+ cat disks
exit 1
fi
-
-rm -r $d
diff --git a/v2v/test-v2v-cdrom.xml b/v2v/test-v2v-cdrom.xml
deleted file mode 100644
index b48d88f..0000000
--- a/v2v/test-v2v-cdrom.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<!--
-libguestfs virt-v2v tool
-Copyright (C) 2009-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.
--->
-<node>
- <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='../tests/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='../tests/guests/blank-disk.img'/>
- <!-- virt-v2v should preserve the device name and bus -->
- <target dev='hdc' bus='ide'/>
- </disk>
- </devices>
- </domain>
-</node>
diff --git a/v2v/test-v2v-i-disk.sh b/v2v/test-v2v-i-disk.sh
index b15e0d0..e385bf3 100755
--- a/v2v/test-v2v-i-disk.sh
+++ b/v2v/test-v2v-i-disk.sh
@@ -22,17 +22,12 @@ unset CDPATH
export LANG=C
set -e
-if [ -n "$SKIP_TEST_V2V_I_DISK_SH" ]; then
- echo "$0: test skipped because environment variable is set"
- exit 77
-fi
-
if [ "$(guestfish get-backend)" = "uml" ]; then
echo "$0: test skipped because UML backend does not support network"
exit 77
fi
-f=../tests/guests/windows.img
+f=$phonydir/windows.img
if ! test -f $f || ! test -s $f; then
echo "$0: test skipped because phony Windows image was not created"
exit 77
diff --git a/v2v/test-v2v-i-ova-formats.sh b/v2v/test-v2v-i-ova-formats.sh
index bd3e048..67dbbde 100755
--- a/v2v/test-v2v-i-ova-formats.sh
+++ b/v2v/test-v2v-i-ova-formats.sh
@@ -24,11 +24,6 @@ set -e
formats="tar zip tar-gz tar-xz"
-if [ -n "$SKIP_TEST_V2V_I_OVA_FORMATS_SH" ]; then
- echo "$0: test skipped because environment variable is set"
- exit 77
-fi
-
if ! zip --version >/dev/null 2>&1; then
echo "$0: test skipped because 'zip' utility is not available"
exit 77
@@ -65,17 +60,17 @@ echo -e "SHA1(disk1.vmdk)=$sha\r" > disk1.mf
for format in $formats; do
case "$format" in
tar)
- tar -cf test-$format.ova ../test-v2v-i-ova-formats.ovf disk1.vmdk disk1.mf
+ tar -cf test-$format.ova $srcdir/test-v2v-i-ova-formats.ovf disk1.vmdk
disk1.mf
;;
zip)
- zip -r test ../test-v2v-i-ova-formats.ovf disk1.vmdk disk1.mf
+ zip -r test $srcdir/test-v2v-i-ova-formats.ovf disk1.vmdk disk1.mf
mv test.zip test-$format.ova
;;
tar-gz)
- tar -czf test-$format.ova ../test-v2v-i-ova-formats.ovf disk1.vmdk disk1.mf
+ tar -czf test-$format.ova $srcdir/test-v2v-i-ova-formats.ovf disk1.vmdk
disk1.mf
;;
tar-xz)
- tar -cJf test-$format.ova ../test-v2v-i-ova-formats.ovf disk1.vmdk disk1.mf
+ tar -cJf test-$format.ova $srcdir/test-v2v-i-ova-formats.ovf disk1.vmdk
disk1.mf
;;
*)
echo "Unhandled format '$format'"
@@ -94,7 +89,7 @@ for format in $formats; do
sed 's,[^ \t]*\(disk.*.vmdk\),\1,' > $d/source
# Check the parsed source is what we expect.
- diff -u test-v2v-i-ova-formats.expected $d/source
+ diff -u $srcdir/test-v2v-i-ova-formats.expected $d/source
done
rm -rf $d
diff --git a/v2v/test-v2v-i-ova-gz.sh b/v2v/test-v2v-i-ova-gz.sh
index 6c630fb..18cce91 100755
--- a/v2v/test-v2v-i-ova-gz.sh
+++ b/v2v/test-v2v-i-ova-gz.sh
@@ -22,11 +22,6 @@ unset CDPATH
export LANG=C
set -e
-if [ -n "$SKIP_TEST_V2V_I_OVA_GZ_SH" ]; then
- echo "$0: test skipped because environment variable is set"
- exit 77
-fi
-
if [ "$(guestfish get-backend)" = "uml" ]; then
echo "$0: test skipped because UML backend does not support network"
exit 77
@@ -49,7 +44,7 @@ gzip disk1.vmdk
sha=`sha1sum disk1.vmdk | awk '{print $1}'`
echo -e "SHA1(disk1.vmdk)=$sha\r" > disk1.mf
-tar -cf test.ova ../test-v2v-i-ova-gz.ovf disk1.vmdk.gz disk1.mf
+tar -cf test.ova $srcdir/test-v2v-i-ova-gz.ovf disk1.vmdk.gz disk1.mf
popd
# Run virt-v2v but only as far as the --print-source stage, and
@@ -60,6 +55,6 @@ $VG virt-v2v --debug-gc --quiet \
sed 's,[^ \t]*\(\.vmdk\),\1,' > $d/source
# Check the parsed source is what we expect.
-diff -u test-v2v-i-ova-gz.expected $d/source
+diff -u $srcdir/test-v2v-i-ova-gz.expected $d/source
rm -rf $d
diff --git a/v2v/test-v2v-i-ova-two-disks.sh b/v2v/test-v2v-i-ova-two-disks.sh
index dfda956..db27573 100755
--- a/v2v/test-v2v-i-ova-two-disks.sh
+++ b/v2v/test-v2v-i-ova-two-disks.sh
@@ -22,11 +22,6 @@ unset CDPATH
export LANG=C
set -e
-if [ -n "$SKIP_TEST_V2V_I_OVA_TWO_DISKS_SH" ]; then
- echo "$0: test skipped because environment variable is set"
- exit 77
-fi
-
if [ "$(guestfish get-backend)" = "uml" ]; then
echo "$0: test skipped because UML backend does not support network"
exit 77
@@ -53,7 +48,7 @@ truncate -s 100k disk2.vmdk
sha=`sha1sum disk2.vmdk | awk '{print $1}'`
echo -e "SHA1(disk2.vmdk)=$sha\r" > disk2.mf
-tar -cf test.ova ../test-v2v-i-ova-two-disks.ovf disk1.vmdk disk1.mf disk2.vmdk disk2.mf
+tar -cf test.ova $srcdir/test-v2v-i-ova-two-disks.ovf disk1.vmdk disk1.mf disk2.vmdk
disk2.mf
popd
# Run virt-v2v but only as far as the --print-source stage, and
@@ -64,6 +59,6 @@ $VG virt-v2v --debug-gc --quiet \
sed 's,[^ \t]*\(disk.*.vmdk\),\1,' > $d/source
# Check the parsed source is what we expect.
-diff -u test-v2v-i-ova-two-disks.expected $d/source
+diff -u $srcdir/test-v2v-i-ova-two-disks.expected $d/source
rm -rf $d
diff --git a/v2v/test-v2v-i-ova.sh b/v2v/test-v2v-i-ova.sh
index 5047eca..1eef6aa 100755
--- a/v2v/test-v2v-i-ova.sh
+++ b/v2v/test-v2v-i-ova.sh
@@ -22,17 +22,12 @@ unset CDPATH
export LANG=C
set -e
-if [ -n "$SKIP_TEST_V2V_I_OVA_SH" ]; then
- echo "$0: test skipped because environment variable is set"
- exit 77
-fi
-
if [ "$(guestfish get-backend)" = "uml" ]; then
echo "$0: test skipped because UML backend does not support network"
exit 77
fi
-f=../tests/guests/windows.img
+f=$phonydir/windows.img
if ! test -f $f || ! test -s $f; then
echo "$0: test skipped because phony Windows image was not created"
exit 77
@@ -55,7 +50,7 @@ ova=test-ova.ova
raw=TestOva-sda
qemu-img convert $f -O vmdk $d/$vmdk
-cp $ovf $d/$ovf
+cp $srcdir/test-v2v-i-ova.ovf $d/$ovf
sha1=`sha1sum $d/$ovf | awk '{print $1}'`
echo "SHA1($ovf)= $sha1" > $d/$mf
sha1=`sha1sum $d/$vmdk | awk '{print $1}'`
@@ -83,6 +78,6 @@ sed \
< $d/TestOva.xml.old > $d/TestOva.xml
# Check the libvirt XML output.
-diff -u test-v2v-i-ova.xml $d/TestOva.xml
+diff -u $srcdir/test-v2v-i-ova.xml $d/TestOva.xml
rm -rf $d
diff --git a/v2v/test-v2v-machine-readable.sh b/v2v/test-v2v-machine-readable.sh
index 3e94ae5..7b0ae9c 100755
--- a/v2v/test-v2v-machine-readable.sh
+++ b/v2v/test-v2v-machine-readable.sh
@@ -22,11 +22,6 @@ unset CDPATH
export LANG=C
set -e
-if [ -n "$SKIP_TEST_V2V_MACHINE_READABLE_SH" ]; then
- echo "$0: test skipped because environment variable is set"
- exit 77
-fi
-
$VG virt-v2v --debug-gc --machine-readable > test-v2v-machine-readable.out
grep virt-v2v test-v2v-machine-readable.out
grep libguestfs-rewrite test-v2v-machine-readable.out
diff --git a/v2v/test-v2v-networks-and-bridges.sh b/v2v/test-v2v-networks-and-bridges.sh
index 68743d6..680ef44 100755
--- a/v2v/test-v2v-networks-and-bridges.sh
+++ b/v2v/test-v2v-networks-and-bridges.sh
@@ -22,20 +22,12 @@ unset CDPATH
export LANG=C
set -e
-if [ -n "$SKIP_TEST_V2V_NETWORKS_AND_BRIDGES_SH" ]; then
- echo "$0: test skipped because environment variable is set"
- exit 77
-fi
-
if [ "$(guestfish get-backend)" = "uml" ]; then
echo "$0: test skipped because UML backend does not support network"
exit 77
fi
-abs_builddir="$(pwd)"
-libvirt_uri="test://$abs_builddir/test-v2v-networks-and-bridges.xml"
-
-f=../tests/guests/windows.img
+f=$phonydir/windows.img
if ! test -f $f || ! test -s $f; then
echo "$0: test skipped because phony Windows image was not created"
exit 77
@@ -47,14 +39,82 @@ if ! test -r $virt_tools_data_dir/rhsrvany.exe; then
exit 77
fi
-d=test-v2v-networks-and-bridges.d
-rm -rf $d
-mkdir $d
+# Libvirt XML.
+echo > guest.xml <<EOF
+<node>
+ <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='$phonydir/windows.img'/>
+ <target dev='vda' bus='virtio'/>
+ </disk>
+
+ <!-- various different networks and bridges which should
+ be renamed by the test -->
+
+ <!-- standard ESX bridge -->
+ <interface type='bridge'>
+ <mac address='00:00:00:00:00:00'/>
+ <source bridge='VM Network'/>
+ <model type='e1000'/>
+ </interface>
+
+ <!-- another bridge to be remapped -->
+ <interface type='bridge'>
+ <mac address='52:54:00:01:02:03'/>
+ <source bridge='bob'/>
+ <model type='e1000'/>
+ </interface>
+
+ <!-- typical libvirt network -->
+ <interface type='network'>
+ <mac address='52:54:00:01:02:04'/>
+ <source network='default'/>
+ <model type='virtio'/>
+ </interface>
+
+ <!-- some more random networks to map -->
+ <interface type='network'>
+ <mac address='52:54:00:01:02:05'/>
+ <source network='john'/>
+ <model type='virtio'/>
+ </interface>
+
+ <interface type='network'>
+ <source network='paul'/>
+ <model type='virtio'/>
+ <mac address='52:54:00:01:02:06'/>
+ </interface>
+
+ <interface type='network'>
+ <model type='rtl8139'/>
+ <source network='george'/>
+ <mac address='52:54:00:01:02:07'/>
+ </interface>
+
+ <interface type='network'>
+ <mac address='52:54:00:01:02:08'/>
+ <model type='virtio'/>
+ <source network='ringo'/>
+ </interface>
+
+ </devices>
+ </domain>
+</node>
+EOF
+libvirt_uri="test://$tmpdir/guest.xml"
# Use --no-copy because we only care about metadata for this test.
$VG virt-v2v --debug-gc \
-i libvirt -ic "$libvirt_uri" windows \
- -o local -os $d --no-copy \
+ -o local -os . --no-copy \
--bridge "VM Network:bridge1" \
-b bridge2 \
--network default:network1 \
@@ -63,15 +123,13 @@ $VG virt-v2v --debug-gc \
--network network4
# Test the libvirt XML metadata was created.
-test -f $d/windows.xml
+test -f windows.xml
# Extract just the network interfaces from the XML.
# Delete the network model XML because that can change depending
# on whether virtio-win is installed or not.
-sed -n '/interface/,/\/interface/p' $d/windows.xml |
- grep -v 'model type=' > $d/networks
+sed -n '/interface/,/\/interface/p' windows.xml |
+ grep -v 'model type=' > networks
# Test that the output has mapped the networks and bridges correctly.
-diff -ur test-v2v-networks-and-bridges-expected.xml $d/networks
-
-rm -r $d
+diff -ur $srcdir/test-v2v-networks-and-bridges-expected.xml networks
diff --git a/v2v/test-v2v-networks-and-bridges.xml
b/v2v/test-v2v-networks-and-bridges.xml
deleted file mode 100644
index a6409f8..0000000
--- a/v2v/test-v2v-networks-and-bridges.xml
+++ /dev/null
@@ -1,85 +0,0 @@
-<!--
-libguestfs virt-v2v tool
-Copyright (C) 2009-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.
--->
-<node>
- <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='../tests/guests/windows.img'/>
- <target dev='vda' bus='virtio'/>
- </disk>
-
- <!-- various different networks and bridges which should
- be renamed by the test -->
-
- <!-- standard ESX bridge -->
- <interface type='bridge'>
- <mac address='00:00:00:00:00:00'/>
- <source bridge='VM Network'/>
- <model type='e1000'/>
- </interface>
-
- <!-- another bridge to be remapped -->
- <interface type='bridge'>
- <mac address='52:54:00:01:02:03'/>
- <source bridge='bob'/>
- <model type='e1000'/>
- </interface>
-
- <!-- typical libvirt network -->
- <interface type='network'>
- <mac address='52:54:00:01:02:04'/>
- <source network='default'/>
- <model type='virtio'/>
- </interface>
-
- <!-- some more random networks to map -->
- <interface type='network'>
- <mac address='52:54:00:01:02:05'/>
- <source network='john'/>
- <model type='virtio'/>
- </interface>
-
- <interface type='network'>
- <source network='paul'/>
- <model type='virtio'/>
- <mac address='52:54:00:01:02:06'/>
- </interface>
-
- <interface type='network'>
- <model type='rtl8139'/>
- <source network='george'/>
- <mac address='52:54:00:01:02:07'/>
- </interface>
-
- <interface type='network'>
- <mac address='52:54:00:01:02:08'/>
- <model type='virtio'/>
- <source network='ringo'/>
- </interface>
-
- </devices>
- </domain>
-</node>
diff --git a/v2v/test-v2v-no-copy.sh b/v2v/test-v2v-no-copy.sh
index f0408dc..882ce28 100755
--- a/v2v/test-v2v-no-copy.sh
+++ b/v2v/test-v2v-no-copy.sh
@@ -22,20 +22,14 @@ unset CDPATH
export LANG=C
set -e
-if [ -n "$SKIP_TEST_V2V_NO_COPY_SH" ]; then
- echo "$0: test skipped because environment variable is set"
- exit 77
-fi
-
if [ "$(guestfish get-backend)" = "uml" ]; then
echo "$0: test skipped because UML backend does not support network"
exit 77
fi
-abs_top_builddir="$(cd ..; pwd)"
-libvirt_uri="test://$abs_top_builddir/tests/guests/guests.xml"
+libvirt_uri="test://$phonydir/guests.xml"
-f=../tests/guests/windows.img
+f=$phonydir/windows.img
if ! test -f $f || ! test -s $f; then
echo "$0: test skipped because phony Windows image was not created"
exit 77
@@ -47,37 +41,31 @@ if ! test -r $virt_tools_data_dir/rhsrvany.exe; then
exit 77
fi
-d=test-v2v-no-copy.d
-rm -rf $d
-mkdir $d
-
# No copy with -o local.
$VG virt-v2v --debug-gc --no-copy \
-i libvirt -ic "$libvirt_uri" windows \
- -o local -os $d
+ -o local -os .
# Test the libvirt XML metadata was created.
-test -f $d/windows.xml
+test -f windows.xml
# Test the disk was NOT created.
-! test -f $d/windows-sda
+! test -f windows-sda
# --no-copy with -o rhev.
-mkdir $d/12345678-1234-1234-1234-123456789abc
-mkdir $d/12345678-1234-1234-1234-123456789abc/images
-mkdir $d/12345678-1234-1234-1234-123456789abc/master
-mkdir $d/12345678-1234-1234-1234-123456789abc/master/vms
+mkdir 12345678-1234-1234-1234-123456789abc
+mkdir 12345678-1234-1234-1234-123456789abc/images
+mkdir 12345678-1234-1234-1234-123456789abc/master
+mkdir 12345678-1234-1234-1234-123456789abc/master/vms
# $VG - XXX Disabled because the forking used to write files in -o rhev
# mode confuses valgrind.
virt-v2v --debug-gc --no-copy \
-i libvirt -ic "$libvirt_uri" windows \
- -o rhev -os $d
+ -o rhev -os .
# Test the OVF metadata was created.
-test -f $d/12345678-1234-1234-1234-123456789abc/master/vms/*/*.ovf
+test -f 12345678-1234-1234-1234-123456789abc/master/vms/*/*.ovf
# Test the disk was NOT created.
-! test -f $d/12345678-1234-1234-1234-123456789abc/images/*/*.meta
-
-rm -r $d
+! test -f 12345678-1234-1234-1234-123456789abc/images/*/*.meta
diff --git a/v2v/test-v2v-o-glance.sh b/v2v/test-v2v-o-glance.sh
index 121177f..7a7366d 100755
--- a/v2v/test-v2v-o-glance.sh
+++ b/v2v/test-v2v-o-glance.sh
@@ -22,20 +22,14 @@ unset CDPATH
export LANG=C
set -e
-if [ -n "$SKIP_TEST_V2V_O_GLANCE_SH" ]; then
- echo "$0: test skipped because environment variable is set"
- exit 77
-fi
-
if [ "$(guestfish get-backend)" = "uml" ]; then
echo "$0: test skipped because UML backend does not support network"
exit 77
fi
-abs_top_builddir="$(cd ..; pwd)"
-libvirt_uri="test://$abs_top_builddir/tests/guests/guests.xml"
+libvirt_uri="test://$phonydir/guests.xml"
-f=../tests/guests/windows.img
+f=$phonydir/windows.img
if ! test -f $f || ! test -s $f; then
echo "$0: test skipped because phony Windows image was not created"
exit 77
@@ -50,6 +44,7 @@ fi
# We don't want to upload to the real glance, so introduce a fake
# glance binary.
ln -sf "$(which echo)" glance
+export PATH=.:$PATH
$VG virt-v2v --debug-gc \
-i libvirt -ic "$libvirt_uri" windows \
diff --git a/v2v/test-v2v-o-libvirt.sh b/v2v/test-v2v-o-libvirt.sh
index 77b38e0..891ca00 100755
--- a/v2v/test-v2v-o-libvirt.sh
+++ b/v2v/test-v2v-o-libvirt.sh
@@ -22,11 +22,6 @@ unset CDPATH
export LANG=C
set -e
-if [ -n "$SKIP_TEST_V2V_O_LIBVIRT_SH" ]; then
- echo "$0: test skipped because environment variable is set"
- exit 77
-fi
-
if [ "$(guestfish get-backend)" = "uml" ]; then
echo "$0: test skipped because UML backend does not support network"
exit 77
@@ -40,10 +35,9 @@ if [ "$(id -u)" -eq 0 ]; then
exit 77
fi
-abs_top_builddir="$(cd ..; pwd)"
-libvirt_uri="test://$abs_top_builddir/tests/guests/guests.xml"
+libvirt_uri="test://$phonydir/guests.xml"
-f=../tests/guests/windows.img
+f=$phonydir/windows.img
if ! test -f $f || ! test -s $f; then
echo "$0: test skipped because phony Windows image was not created"
exit 77
@@ -58,20 +52,16 @@ fi
# Generate a random guest name.
guestname=tmp-$(tr -cd 'a-f0-9' < /dev/urandom | head -c 8)
-d=test-v2v-o-libvirt.d
-rm -rf $d
-mkdir $d
-
# Set up the output directory as a libvirt storage pool.
virsh pool-destroy test-v2v-libvirt ||:
-virsh pool-create-as test-v2v-libvirt dir - - - - $(pwd)/$d
+virsh pool-create-as test-v2v-libvirt dir - - - - $(pwd)
$VG virt-v2v --debug-gc \
-i libvirt -ic "$libvirt_uri" windows \
-o libvirt -os test-v2v-libvirt -on $guestname
# Test the disk was created.
-test -f $d/$guestname-sda
+test -f $guestname-sda
# Test the guest exists.
virsh dumpxml $guestname
@@ -79,4 +69,3 @@ virsh dumpxml $guestname
# Clean up.
virsh pool-destroy test-v2v-libvirt ||:
virsh undefine $guestname ||:
-rm -r $d
diff --git a/v2v/test-v2v-o-null.sh b/v2v/test-v2v-o-null.sh
index 9ed581b..bced065 100755
--- a/v2v/test-v2v-o-null.sh
+++ b/v2v/test-v2v-o-null.sh
@@ -22,20 +22,14 @@ unset CDPATH
export LANG=C
set -e
-if [ -n "$SKIP_TEST_V2V_O_NULL_SH" ]; then
- echo "$0: test skipped because environment variable is set"
- exit 77
-fi
-
if [ "$(guestfish get-backend)" = "uml" ]; then
echo "$0: test skipped because UML backend does not support network"
exit 77
fi
-abs_top_builddir="$(cd ..; pwd)"
-libvirt_uri="test://$abs_top_builddir/tests/guests/guests.xml"
+libvirt_uri="test://$phonydir/guests.xml"
-f=../tests/guests/windows.img
+f=$phonydir/windows.img
if ! test -f $f || ! test -s $f; then
echo "$0: test skipped because phony Windows image was not created"
exit 77
diff --git a/v2v/test-v2v-o-qemu.sh b/v2v/test-v2v-o-qemu.sh
index 9de2b56..a1a92f5 100755
--- a/v2v/test-v2v-o-qemu.sh
+++ b/v2v/test-v2v-o-qemu.sh
@@ -22,20 +22,14 @@ unset CDPATH
export LANG=C
set -e
-if [ -n "$SKIP_TEST_V2V_O_QEMU_SH" ]; then
- echo "$0: test skipped because environment variable is set"
- exit 77
-fi
-
if [ "$(guestfish get-backend)" = "uml" ]; then
echo "$0: test skipped because UML backend does not support network"
exit 77
fi
-abs_top_builddir="$(cd ..; pwd)"
libvirt_uri="test://$abs_top_builddir/tests/guests/guests.xml"
-f=../tests/guests/windows.img
+f=$phonydir/windows.img
if ! test -f $f || ! test -s $f; then
echo "$0: test skipped because phony Windows image was not created"
exit 77
diff --git a/v2v/test-v2v-o-rhev.sh b/v2v/test-v2v-o-rhev.sh
index 1162e31..e5baf99 100755
--- a/v2v/test-v2v-o-rhev.sh
+++ b/v2v/test-v2v-o-rhev.sh
@@ -22,20 +22,14 @@ unset CDPATH
export LANG=C
set -e
-if [ -n "$SKIP_TEST_V2V_O_RHEV_SH" ]; then
- echo "$0: test skipped because environment variable is set"
- exit 77
-fi
-
if [ "$(guestfish get-backend)" = "uml" ]; then
echo "$0: test skipped because UML backend does not support network"
exit 77
fi
-abs_top_builddir="$(cd ..; pwd)"
-libvirt_uri="test://$abs_top_builddir/tests/guests/guests.xml"
+libvirt_uri="test://$phonydir/guests.xml"
-f=../tests/guests/windows.img
+f=$phonydir/windows.img
if ! test -f $f || ! test -s $f; then
echo "$0: test skipped because phony Windows image was not created"
exit 77
@@ -47,26 +41,22 @@ if ! test -r $virt_tools_data_dir/rhsrvany.exe; then
exit 77
fi
-d=test-v2v-o-rhev.d
-rm -rf $d
-mkdir $d
-
# Create a dummy Export Storage Domain.
-mkdir $d/12345678-1234-1234-1234-123456789abc
-mkdir $d/12345678-1234-1234-1234-123456789abc/images
-mkdir $d/12345678-1234-1234-1234-123456789abc/master
-mkdir $d/12345678-1234-1234-1234-123456789abc/master/vms
+mkdir 12345678-1234-1234-1234-123456789abc
+mkdir 12345678-1234-1234-1234-123456789abc/images
+mkdir 12345678-1234-1234-1234-123456789abc/master
+mkdir 12345678-1234-1234-1234-123456789abc/master/vms
# $VG - XXX Disabled because the forking used to write files in -o rhev
# mode confuses valgrind.
virt-v2v --debug-gc \
-i libvirt -ic "$libvirt_uri" windows \
- -o rhev -os $d
+ -o rhev -os .
# Test the OVF metadata was created.
-test -f $d/12345678-1234-1234-1234-123456789abc/master/vms/*/*.ovf
+test -f 12345678-1234-1234-1234-123456789abc/master/vms/*/*.ovf
-pushd $d/12345678-1234-1234-1234-123456789abc/images/*
+pushd 12345678-1234-1234-1234-123456789abc/images/*
# Test the disk .meta was created.
test -f *.meta
@@ -76,5 +66,3 @@ vol=`basename *.meta .meta`
test -f $vol
popd
-
-rm -r $d
diff --git a/v2v/test-v2v-o-vdsm-options.sh b/v2v/test-v2v-o-vdsm-options.sh
index c170467..b9140c5 100755
--- a/v2v/test-v2v-o-vdsm-options.sh
+++ b/v2v/test-v2v-o-vdsm-options.sh
@@ -22,20 +22,14 @@ unset CDPATH
export LANG=C
set -e
-if [ -n "$SKIP_TEST_V2V_O_VDSM_OPTIONS_SH" ]; then
- echo "$0: test skipped because environment variable is set"
- exit 77
-fi
-
if [ "$(guestfish get-backend)" = "uml" ]; then
echo "$0: test skipped because UML backend does not support network"
exit 77
fi
-abs_top_builddir="$(cd ..; pwd)"
-libvirt_uri="test://$abs_top_builddir/tests/guests/guests.xml"
+libvirt_uri="test://$phonydir/guests.xml"
-f=../tests/guests/windows.img
+f=$phonydir/windows.img
if ! test -f $f || ! test -s $f; then
echo "$0: test skipped because phony Windows image was not created"
exit 77
@@ -47,38 +41,34 @@ if ! test -r $virt_tools_data_dir/rhsrvany.exe; then
exit 77
fi
-d=test-v2v-o-vdsm-options.d
-rm -rf $d
-mkdir $d
-
# Create a dummy Export Storage Domain.
-mkdir $d/12345678-1234-1234-1234-123456789abc
-mkdir $d/12345678-1234-1234-1234-123456789abc/images
-mkdir $d/12345678-1234-1234-1234-123456789abc/images/IMAGE
-mkdir $d/12345678-1234-1234-1234-123456789abc/master
-mkdir $d/12345678-1234-1234-1234-123456789abc/master/vms
-mkdir $d/12345678-1234-1234-1234-123456789abc/master/vms/VM
+mkdir 12345678-1234-1234-1234-123456789abc
+mkdir 12345678-1234-1234-1234-123456789abc/images
+mkdir 12345678-1234-1234-1234-123456789abc/images/IMAGE
+mkdir 12345678-1234-1234-1234-123456789abc/master
+mkdir 12345678-1234-1234-1234-123456789abc/master/vms
+mkdir 12345678-1234-1234-1234-123456789abc/master/vms/VM
# The --vdsm-*-uuid options don't actually check that the
# parameter is a UUID, which is useful here.
$VG virt-v2v --debug-gc \
-i libvirt -ic "$libvirt_uri" windows \
- -o vdsm -os $d/12345678-1234-1234-1234-123456789abc \
+ -o vdsm -os 12345678-1234-1234-1234-123456789abc \
--vmtype desktop \
--vdsm-image-uuid IMAGE \
--vdsm-vol-uuid VOL \
--vdsm-vm-uuid VM \
- --vdsm-ovf-output $d/12345678-1234-1234-1234-123456789abc/master/vms/VM \
+ --vdsm-ovf-output 12345678-1234-1234-1234-123456789abc/master/vms/VM \
# Test the OVF metadata was created.
-test -f $d/12345678-1234-1234-1234-123456789abc/master/vms/VM/VM.ovf
+test -f 12345678-1234-1234-1234-123456789abc/master/vms/VM/VM.ovf
# Test the OVF metadata contains <VmType>0</VmType> (desktop).
grep '<VmType>0</VmType>' \
- $d/12345678-1234-1234-1234-123456789abc/master/vms/VM/VM.ovf
+ 12345678-1234-1234-1234-123456789abc/master/vms/VM/VM.ovf
-pushd $d/12345678-1234-1234-1234-123456789abc/images/IMAGE
+pushd 12345678-1234-1234-1234-123456789abc/images/IMAGE
# Test the disk .meta was created.
test -f VOL.meta
@@ -87,5 +77,3 @@ test -f VOL.meta
test -f VOL
popd
-
-rm -r $d
diff --git a/v2v/test-v2v-of-option.sh b/v2v/test-v2v-of-option.sh
index 27441cf..1d17283 100755
--- a/v2v/test-v2v-of-option.sh
+++ b/v2v/test-v2v-of-option.sh
@@ -22,20 +22,14 @@ unset CDPATH
export LANG=C
set -e
-if [ -n "$SKIP_TEST_V2V_OF_OPTION_SH" ]; then
- echo "$0: test skipped because environment variable is set"
- exit 77
-fi
-
if [ "$(guestfish get-backend)" = "uml" ]; then
echo "$0: test skipped because UML backend does not support network or
qcow2"
exit 77
fi
-abs_top_builddir="$(cd ..; pwd)"
-libvirt_uri="test://$abs_top_builddir/tests/guests/guests.xml"
+libvirt_uri="test://$phonydir/guests.xml"
-f=../tests/guests/windows.img
+f=$phonydir/windows.img
if ! test -f $f || ! test -s $f; then
echo "$0: test skipped because phony Windows image was not created"
exit 77
@@ -47,18 +41,12 @@ if ! test -r $virt_tools_data_dir/rhsrvany.exe; then
exit 77
fi
-d=test-v2v-windows-conversion.d
-rm -rf $d
-mkdir $d
-
$VG virt-v2v --debug-gc \
-i libvirt -ic "$libvirt_uri" windows \
- -o local -os $d -of qcow2
+ -o local -os . -of qcow2
# Test the disk is qcow2 format.
-if [ "$(guestfish disk-format $d/windows-sda)" != qcow2 ]; then
+if [ "$(guestfish disk-format windows-sda)" != qcow2 ]; then
echo "$0: test failed: output is not qcow2"
exit 1
fi
-
-rm -r $d
diff --git a/v2v/test-v2v-on-option.sh b/v2v/test-v2v-on-option.sh
index e3edb67..8536a91 100755
--- a/v2v/test-v2v-on-option.sh
+++ b/v2v/test-v2v-on-option.sh
@@ -22,20 +22,14 @@ unset CDPATH
export LANG=C
set -e
-if [ -n "$SKIP_TEST_V2V_ON_OPTION_SH" ]; then
- echo "$0: test skipped because environment variable is set"
- exit 77
-fi
-
if [ "$(guestfish get-backend)" = "uml" ]; then
echo "$0: test skipped because UML backend does not support network"
exit 77
fi
-abs_top_builddir="$(cd ..; pwd)"
-libvirt_uri="test://$abs_top_builddir/tests/guests/guests.xml"
+libvirt_uri="test://$phonydir/guests.xml"
-f=../tests/guests/windows.img
+f=$phonydir/windows.img
if ! test -f $f || ! test -s $f; then
echo "$0: test skipped because phony Windows image was not created"
exit 77
@@ -47,16 +41,10 @@ if ! test -r $virt_tools_data_dir/rhsrvany.exe; then
exit 77
fi
-d=test-v2v-windows-conversion.d
-rm -rf $d
-mkdir $d
-
$VG virt-v2v --debug-gc \
-i libvirt -ic "$libvirt_uri" windows \
- -o local -os $d -on this-is-not-windows
+ -o local -os . -on this-is-not-windows
# Test the libvirt XML metadata and a disk was created.
-test -f $d/this-is-not-windows.xml
-test -f $d/this-is-not-windows-sda
-
-rm -r $d
+test -f this-is-not-windows.xml
+test -f this-is-not-windows-sda
diff --git a/v2v/test-v2v-print-source.sh b/v2v/test-v2v-print-source.sh
index e7a8382..fd57989 100755
--- a/v2v/test-v2v-print-source.sh
+++ b/v2v/test-v2v-print-source.sh
@@ -22,38 +22,28 @@ unset CDPATH
export LANG=C
set -e
-if [ -n "$SKIP_TEST_V2V_PRINT_SOURCE_SH" ]; then
- echo "$0: test skipped because environment variable is set"
- exit 77
-fi
+libvirt_uri="test://$phonydir/guests.xml"
-abs_top_builddir="$(cd ..; pwd)"
-libvirt_uri="test://$abs_top_builddir/tests/guests/guests.xml"
-
-f=../tests/guests/windows.img
+f=$phonydir/windows.img
if ! test -f $f || ! test -s $f; then
echo "$0: test skipped because phony Windows image was not created"
exit 77
fi
-d=test-v2v-print-source.d
-rm -rf $d
-mkdir $d
-
$VG virt-v2v --debug-gc \
-i libvirt -ic "$libvirt_uri" windows \
- -o local -os $d \
- --print-source > $d/output
+ -o local -os . \
+ --print-source > output
-mv $d/output $d/output.orig
-< $d/output.orig \
+mv output output.orig
+< output.orig \
grep -v 'Opening the source' |
grep -v 'Source guest information' |
sed -e 's,/.*/,/,' |
grep -v '^$' \
-> $d/output
+> output
-if [ "$(cat $d/output)" != " source name: windows
+if [ "$(cat output)" != " source name: windows
hypervisor type: test
memory: 1073741824 (bytes)
nr vCPUs: 1
@@ -66,8 +56,6 @@ disks:
removable media:
NICs:" ]; then
echo "$0: unexpected output from test:"
- cat $d/output.orig
+ cat output.orig
exit 1
fi
-
-rm -r $d
diff --git a/v2v/test-v2v-real-conversions.sh b/v2v/test-v2v-real-conversions.sh
index bb98488..adb7b4e 100755
--- a/v2v/test-v2v-real-conversions.sh
+++ b/v2v/test-v2v-real-conversions.sh
@@ -18,31 +18,24 @@
# Test virt-v2v on some real guests.
#
-# The phony Fedora guest isn't sufficient for testing. The
-# Makefile.am builds some real guests using virt-builder and we just
-# run virt-v2v on those (to make sure it doesn't crash / assert).
+# The phony Fedora guest isn't sufficient for testing. Build some
+# real guests and run virt-v2v on those (to make sure it doesn't
+# crash / assert).
unset CDPATH
export LANG=C
set -e
-if [ -n "$SKIP_TEST_V2V_REAL_CONVERSIONS_SH" ]; then
- echo "$0: test skipped because environment variable is set"
- exit 77
-fi
+real_guests="centos-6 centos-7.0 fedora-22 rhel-5.10 rhel-6.5 rhel-7.0"
-d=test-v2v-real-conversions.d
-rm -rf $d
-mkdir $d
-
-for file in *.img; do
- if test -f $file && test -s $file ; then
- n=`basename $file .img`
+for g in $real_guests; do
+ if virt-builder --help >/dev/null && virt-builder --notes $g
>/dev/null; then
+ virt-builder $g
# Create some minimal test metadata.
- cat > $d/$n-input.xml <<EOF
+ cat > $g-input.xml <<EOF
<domain type='test'>
- <name>$n</name>
+ <name>$g</name>
<memory>1048576</memory>
<os>
<type>hvm</type>
@@ -51,7 +44,7 @@ for file in *.img; do
<devices>
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
- <source file='$(pwd)/$file'/>
+ <source file='$(pwd)/$g.img'/>
<target dev='vda' bus='virtio'/>
</disk>
</devices>
@@ -59,24 +52,22 @@ for file in *.img; do
EOF
virt-v2v --debug-gc \
- -i libvirtxml $d/$n-input.xml \
- -o local -os $d
+ -i libvirtxml $g-input.xml \
+ -o local -os $(pwd)
# Test the libvirt XML metadata and a disk was created.
- test -f $d/$n.xml
- test -f $d/$n-sda
+ test -f $g.xml
+ test -f $g-sda
# Test the disk has a similar size to the original.
- size_before="$(du $file | awk '{print $1}')"
- size_after="$(du $d/$n-sda | awk '{print $1}')"
+ size_before="$(du $g.img | awk '{print $1}')"
+ size_after="$(du $g-sda | awk '{print $1}')"
diff="$(( 100 * size_after / size_before ))"
if test $diff -lt 50; then
echo "$0: disk image may have been corrupted or truncated"
echo "size_before=$size_before size_after=$size_after diff=$diff"
- ls -l $file $d/$n-sda
+ ls -l $file $g-sda
exit 1
fi
fi
done
-
-rm -r $d
diff --git a/v2v/test-v2v-sound.sh b/v2v/test-v2v-sound.sh
index 7cb6f24..cf29fb3 100755
--- a/v2v/test-v2v-sound.sh
+++ b/v2v/test-v2v-sound.sh
@@ -22,20 +22,12 @@ unset CDPATH
export LANG=C
set -e
-if [ -n "$SKIP_TEST_V2V_SOUND_SH" ]; then
- echo "$0: test skipped because environment variable is set"
- exit 77
-fi
-
if [ "$(guestfish get-backend)" = "uml" ]; then
echo "$0: test skipped because UML backend does not support network"
exit 77
fi
-abs_builddir="$(pwd)"
-libvirt_uri="test://$abs_builddir/test-v2v-sound.xml"
-
-f=../tests/guests/windows.img
+f=$phonydir/windows.img
if ! test -f $f || ! test -s $f; then
echo "$0: test skipped because phony Windows image was not created"
exit 77
@@ -47,18 +39,35 @@ if ! test -r $virt_tools_data_dir/rhsrvany.exe; then
exit 77
fi
-d=test-v2v-sound.d
-rm -rf $d
-mkdir $d
+# Libvirt XML.
+echo > guest.xml <<EOF
+<node>
+ <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='$phonydir/windows.img'/>
+ <target dev='vda' bus='virtio'/>
+ </disk>
+ <sound model="ich9"/>
+ </devices>
+ </domain>
+</node>
+EOF
+libvirt_uri="test://$tmpdir/guest.xml"
$VG virt-v2v --debug-gc \
-i libvirt -ic "$libvirt_uri" windows \
- -o local -os $d --no-copy
+ -o local -os . --no-copy
# Test the libvirt XML metadata was created.
-test -f $d/windows.xml
+test -f windows.xml
# Check the <sound> element exists in the output.
-grep 'sound model=.ich9' $d/windows.xml
-
-rm -r $d
+grep 'sound model=.ich9' windows.xml
diff --git a/v2v/test-v2v-sound.xml b/v2v/test-v2v-sound.xml
deleted file mode 100644
index f2babef..0000000
--- a/v2v/test-v2v-sound.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<!--
-libguestfs virt-v2v tool
-Copyright (C) 2009-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.
--->
-<node>
- <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='../tests/guests/windows.img'/>
- <target dev='vda' bus='virtio'/>
- </disk>
- <sound model="ich9"/>
- </devices>
- </domain>
-</node>
diff --git a/v2v/test-v2v-windows-conversion.sh b/v2v/test-v2v-windows-conversion.sh
index 7e8e628..4ce93f8 100755
--- a/v2v/test-v2v-windows-conversion.sh
+++ b/v2v/test-v2v-windows-conversion.sh
@@ -22,20 +22,14 @@ unset CDPATH
export LANG=C
set -e
-if [ -n "$SKIP_TEST_V2V_WINDOWS_CONVERSION_SH" ]; then
- echo "$0: test skipped because environment variable is set"
- exit 77
-fi
-
if [ "$(guestfish get-backend)" = "uml" ]; then
echo "$0: test skipped because UML backend does not support network"
exit 77
fi
-abs_top_builddir="$(cd ..; pwd)"
-libvirt_uri="test://$abs_top_builddir/tests/guests/guests.xml"
+libvirt_uri="test://$phonydir/guests.xml"
-f=../tests/guests/windows.img
+f=$phonydir/windows.img
if ! test -f $f || ! test -s $f; then
echo "$0: test skipped because phony Windows image was not created"
exit 77
@@ -57,21 +51,17 @@ function random_choice
choices=("/dev/sda2" "single" "first")
root=`random_choice`
-d=test-v2v-windows-conversion.d
-rm -rf $d
-mkdir $d
-
$VG virt-v2v --debug-gc \
-i libvirt -ic "$libvirt_uri" windows \
- -o local -os $d \
+ -o local -os . \
--root $root
# Test the libvirt XML metadata and a disk was created.
-test -f $d/windows.xml
-test -f $d/windows-sda
+test -f windows.xml
+test -f windows-sda
# Test some aspects of the target disk image.
-guestfish --ro -a $d/windows-sda -i <<EOF
+guestfish --ro -a windows-sda -i <<EOF
is-dir "/Program Files/Red Hat/Firstboot"
is-file "/Program Files/Red Hat/Firstboot/firstboot.bat"
is-dir "/Program Files/Red Hat/Firstboot/scripts"
@@ -81,5 +71,3 @@ EOF
# We also update the Registry several times, for firstboot, and (ONLY
# if the virtio-win drivers are installed locally) the critical device
# database.
-
-rm -r $d
diff --git a/v2v/tests.mk b/v2v/tests.mk
new file mode 100644
index 0000000..a10844f
--- /dev/null
+++ b/v2v/tests.mk
@@ -0,0 +1,101 @@
+# libguestfs generated file
+# WARNING: THIS FILE IS GENERATED FROM:
+# generator/ *.ml
+# ANY CHANGES YOU MAKE TO THIS FILE WILL BE LOST.
+#
+# Copyright (C) 2009-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.
+
+localtestsdir = $(alltestsdir)/v2v
+
+localtests_DATA = \
+ test-v2v-cdrom.expected \
+ test-v2v-i-ova-formats.expected \
+ test-v2v-i-ova-formats.ovf \
+ test-v2v-i-ova-gz.expected \
+ test-v2v-i-ova-gz.ovf \
+ test-v2v-i-ova-two-disks.expected \
+ test-v2v-i-ova-two-disks.ovf \
+ test-v2v-i-ova.ovf \
+ test-v2v-i-ova.xml \
+ test-v2v-networks-and-bridges-expected.xml
+
+localtests_SCRIPTS = \
+ test-v2v-cdrom.sh \
+ test-v2v-i-disk.sh \
+ test-v2v-i-ova-formats.sh \
+ test-v2v-i-ova-gz.sh \
+ test-v2v-i-ova-two-disks.sh \
+ test-v2v-i-ova.sh \
+ test-v2v-machine-readable.sh \
+ test-v2v-networks-and-bridges.sh \
+ test-v2v-no-copy.sh \
+ test-v2v-o-glance.sh \
+ test-v2v-o-libvirt.sh \
+ test-v2v-o-null.sh \
+ test-v2v-o-qemu.sh \
+ test-v2v-o-rhev.sh \
+ test-v2v-o-vdsm-options.sh \
+ test-v2v-of-option.sh \
+ test-v2v-on-option.sh \
+ test-v2v-print-source.sh \
+ test-v2v-real-conversions.sh \
+ test-v2v-sound.sh \
+ test-v2v-windows-conversion.sh
+
+localtests_PROGRAMS = \
+ v2v_unit_tests
+
+# Note that we cannot create a simple 'check:' target since
+# automake will (silently) overrule it, so we do this instead:
+
+TESTS_ENVIRONMENT = $(top_builddir)/run
+TESTS = $(top_builddir)/test-harness
+
+check-valgrind:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind
+
+check-direct:
+ $(top_builddir)/run $(top_builddir)/test-harness --direct
+
+check-valgrind-direct:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind --direct
+
+check-libvirt:
+ $(top_builddir)/run $(top_builddir)/test-harness --libvirt
+
+check-valgrind-libvirt:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind --libvirt
+
+check-uml:
+ $(top_builddir)/run $(top_builddir)/test-harness --uml
+
+check-valgrind-uml:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind --uml
+
+check-with-upstream-qemu:
+ $(top_builddir)/run $(top_builddir)/test-harness --upstream-qemu
+
+check-with-upstream-libvirt:
+ $(top_builddir)/run $(top_builddir)/test-harness --upstream-libvirt
+
+check-fast:
+ $(top_builddir)/run $(top_builddir)/test-harness --fast
+
+check-slow:
+ $(top_builddir)/run $(top_builddir)/test-harness --slow
+
+EXTRA_DIST += tests.mk
--
2.5.0