[Pkg-libvirt-commits] [libguestfs] 111/266: v2v: Add a test of -o libvirt target.

Hilko Bengen bengen at moszumanska.debian.org
Fri Oct 3 14:41:48 UTC 2014


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to annotated tag debian/1%1.27.35-1
in repository libguestfs.

commit 3243da393b2630997c4e10b39a5f6fa2585b7e10
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Fri Aug 15 14:37:04 2014 +0100

    v2v: Add a test of -o libvirt target.
---
 v2v/Makefile.am         |  1 +
 v2v/test-v2v-libvirt.sh | 82 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 83 insertions(+)

diff --git a/v2v/Makefile.am b/v2v/Makefile.am
index e2f4635..25443e4 100644
--- a/v2v/Makefile.am
+++ b/v2v/Makefile.am
@@ -175,6 +175,7 @@ TESTS_ENVIRONMENT = $(top_builddir)/run --test
 
 if ENABLE_APPLIANCE
 TESTS = \
+	test-v2v-libvirt.sh \
 	test-v2v-machine-readable.sh \
 	test-v2v-no-copy.sh \
 	test-v2v-of-option.sh \
diff --git a/v2v/test-v2v-libvirt.sh b/v2v/test-v2v-libvirt.sh
new file mode 100755
index 0000000..ba205ec
--- /dev/null
+++ b/v2v/test-v2v-libvirt.sh
@@ -0,0 +1,82 @@
+#!/bin/bash -
+# libguestfs virt-v2v test script
+# Copyright (C) 2014 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.
+
+# Test -o libvirt.
+
+unset CDPATH
+export LANG=C
+set -e
+
+if [ -n "$SKIP_TEST_V2V_LIBVIRT_SH" ]; then
+    echo "$0: test skipped because environment variable is set"
+    exit 77
+fi
+
+if [ "$(../fish/guestfish get-backend)" = "uml" ]; then
+    echo "$0: test skipped because UML backend does not support network"
+    exit 77
+fi
+
+# You shouldn't be running the tests as root anyway, but in this case
+# it's especially bad because we don't want to start creating guests
+# or storage pools in the system namespace.
+if [ "$(id -u)" -eq 0 ]; then
+    echo "$0: test skipped because you're running tests as root.  Don't do that!"
+    exit 77
+fi
+
+abs_top_builddir="$(cd ..; pwd)"
+libvirt_uri="test://$abs_top_builddir/tests/guests/guests-all-good.xml"
+
+f=../tests/guests/windows.img
+if ! test -f $f || ! test -s $f; then
+    echo "$0: test skipped because phony Windows image was not created"
+    exit 77
+fi
+
+virt_tools_data_dir=${VIRT_TOOLS_DATA_DIR:-/usr/share/virt-tools}
+if ! test -r $virt_tools_data_dir/rhsrvany.exe; then
+    echo "$0: test skipped because rhsrvany.exe is not installed"
+    exit 77
+fi
+
+# Generate a random guest name.
+guestname=tmp-$(tr -cd 'a-f0-9' < /dev/urandom | head -c 8)
+
+d=test-v2v-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
+
+$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 the guest exists.
+virsh dumpxml $guestname
+
+# Clean up.
+virsh pool-destroy test-v2v-libvirt ||:
+virsh undefine $guestname ||:
+rm -r $d

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list