[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH v2 3/3] v2v: tests: test paths for installation of linux guest tools



Signed-off-by: Tomáš Golembiovský <tgolembi redhat com>
---
 v2v/Makefile.am                  |  1 +
 v2v/test-v2v-copy-guest-tools.sh | 87 ++++++++++++++++++++++++++++++++
 2 files changed, 88 insertions(+)
 create mode 100755 v2v/test-v2v-copy-guest-tools.sh

diff --git a/v2v/Makefile.am b/v2v/Makefile.am
index 2312812fb..84667e11d 100644
--- a/v2v/Makefile.am
+++ b/v2v/Makefile.am
@@ -456,6 +456,7 @@ TESTS += \
 if HAVE_LIBVIRT
 TESTS += \
 	test-v2v-cdrom.sh \
+	test-v2v-copy-guest-tools.sh \
 	test-v2v-floppy.sh \
 	test-v2v-in-place.sh \
 	test-v2v-mac.sh \
diff --git a/v2v/test-v2v-copy-guest-tools.sh b/v2v/test-v2v-copy-guest-tools.sh
new file mode 100755
index 000000000..e9c1e5b90
--- /dev/null
+++ b/v2v/test-v2v-copy-guest-tools.sh
@@ -0,0 +1,87 @@
+#!/bin/bash -
+# libguestfs virt-v2v test script
+# Copyright (C) 2019 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 copying of guest tools into guest
+
+set -e
+
+$TEST_FUNCTIONS
+slow_test
+skip_if_skipped
+skip_unless_arch x86_64
+
+guestname="fedora-29"
+
+d=test-v2v-copy-guest-tools.d
+disk="$guestname.img"
+xml="$guestname.xml"
+libvirt_uri="test://$abs_builddir/$xml"
+
+rm -f "$disk" "$xml"
+rm -rf $d
+mkdir $d
+
+# Build a guest (using virt-builder).
+virt-builder "$guestname" --quiet -o "$disk" --selinux-relabel
+
+# Create some minimal test metadata.
+cat > "$xml" <<EOF
+<node>
+  <domain type='test'>
+    <name>$guestname</name>
+    <memory>1048576</memory>
+    <os>
+      <type>hvm</type>
+      <boot dev='hd'/>
+    </os>
+    <devices>
+      <disk type='file' device='disk'>
+        <driver name='qemu' type='raw'/>
+        <source file='$abs_builddir/$disk'/>
+        <target dev='vda' bus='virtio'/>
+      </disk>
+    </devices>
+  </domain>
+</node>
+EOF
+
+export VIRTIO_WIN="$d/fake-tools"
+
+rm -rf $d
+mkdir -p $d
+mkdir -p $VIRTIO_WIN/linux/fedora{,27,29}
+# has: fedora, fedora27, fedora29; should use: fedora29
+$VG virt-v2v --debug-gc -v -x \
+    -i libvirt -ic "$libvirt_uri" $guestname \
+    -o local -os $d > $d/log 2>&1
+grep '^locating packages in: linux/fedora29, linux/fedora, linux/fc28$' $d/log
+grep "^cd 'test-v2v-copy-guest-tools.d/fake-tools/linux/fedora29' && " $d/log
+
+rm -rf $d
+mkdir -p $d
+mkdir -p $VIRTIO_WIN/linux/fedora{,27}
+# has: fedora, fedora27; should use: fedora
+$VG virt-v2v --debug-gc -v -x \
+    -i libvirt -ic "$libvirt_uri" $guestname \
+    -o local -os $d > $d/log 2>&1
+grep '^locating packages in: linux/fedora29, linux/fedora, linux/fc28$' $d/log
+grep "^cd 'test-v2v-copy-guest-tools.d/fake-tools/linux/fedora' && " $d/log
+
+# Finished
+rm -r $d
+rm -f "$disk" "$xml"
-- 
2.20.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]