Blame SOURCES/0049-tests-Add-test-of-i-ova-from-a-directory.patch

8984ae
From 7748be2af952898c9c38d02e9a539c71cbfbb56b Mon Sep 17 00:00:00 2001
8984ae
From: "Richard W.M. Jones" <rjones@redhat.com>
8984ae
Date: Tue, 25 May 2021 10:13:00 +0100
8984ae
Subject: [PATCH] tests: Add test of -i ova from a directory.
8984ae
8984ae
This was not tested previously.
8984ae
8984ae
(cherry picked from commit a00ce662cb33c33706a013ff98ff89244cd14667)
8984ae
---
8984ae
 tests/Makefile.am                 |  2 ++
8984ae
 tests/test-v2v-i-ova-directory.sh | 53 +++++++++++++++++++++++++++++++
8984ae
 2 files changed, 55 insertions(+)
8984ae
 create mode 100755 tests/test-v2v-i-ova-directory.sh
8984ae
8984ae
diff --git a/tests/Makefile.am b/tests/Makefile.am
8984ae
index eee4e1af..e4b907fe 100644
8984ae
--- a/tests/Makefile.am
8984ae
+++ b/tests/Makefile.am
8984ae
@@ -58,6 +58,7 @@ TESTS = \
8984ae
 	test-v2v-copy-to-local.sh \
8984ae
 	test-v2v-i-ova-bad-sha1.sh \
8984ae
 	test-v2v-i-ova-bad-sha256.sh \
8984ae
+	test-v2v-i-ova-directory.sh \
8984ae
 	test-v2v-i-ova-formats.sh \
8984ae
 	test-v2v-i-ova-good-checksums.sh \
8984ae
 	test-v2v-i-ova-gz.sh \
8984ae
@@ -185,6 +186,7 @@ EXTRA_DIST += \
8984ae
 	test-v2v-i-ova-bad-sha1.sh \
8984ae
 	test-v2v-i-ova-bad-sha256.sh \
8984ae
 	test-v2v-i-ova-checksums.ovf \
8984ae
+	test-v2v-i-ova-directory.sh \
8984ae
 	test-v2v-i-ova-formats.expected \
8984ae
 	test-v2v-i-ova-formats.ovf \
8984ae
 	test-v2v-i-ova-formats.sh \
8984ae
diff --git a/tests/test-v2v-i-ova-directory.sh b/tests/test-v2v-i-ova-directory.sh
8984ae
new file mode 100755
8984ae
index 00000000..7c593139
8984ae
--- /dev/null
8984ae
+++ b/tests/test-v2v-i-ova-directory.sh
8984ae
@@ -0,0 +1,53 @@
8984ae
+#!/bin/bash -
8984ae
+# libguestfs virt-v2v test script
8984ae
+# Copyright (C) 2014-2021 Red Hat Inc.
8984ae
+#
8984ae
+# This program is free software; you can redistribute it and/or modify
8984ae
+# it under the terms of the GNU General Public License as published by
8984ae
+# the Free Software Foundation; either version 2 of the License, or
8984ae
+# (at your option) any later version.
8984ae
+#
8984ae
+# This program is distributed in the hope that it will be useful,
8984ae
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
8984ae
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
8984ae
+# GNU General Public License for more details.
8984ae
+#
8984ae
+# You should have received a copy of the GNU General Public License
8984ae
+# along with this program; if not, write to the Free Software
8984ae
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
8984ae
+
8984ae
+# Test -i ova option with a directory.
8984ae
+
8984ae
+set -e
8984ae
+
8984ae
+$TEST_FUNCTIONS
8984ae
+skip_if_skipped
8984ae
+skip_if_backend uml
8984ae
+skip_unless_phony_guest windows.img
8984ae
+
8984ae
+skip_unless_libvirt_minimum_version 3 1 0
8984ae
+
8984ae
+export VIRT_TOOLS_DATA_DIR="$top_srcdir/test-data/fake-virt-tools"
8984ae
+export VIRTIO_WIN="$top_srcdir/test-data/fake-virtio-win"
8984ae
+
8984ae
+d=test-v2v-i-ova-directory.d
8984ae
+rm -rf $d
8984ae
+mkdir $d
8984ae
+
8984ae
+vmdk=test-ova.vmdk
8984ae
+ovf=test-v2v-i-ova.ovf
8984ae
+mf=test-ova.mf
8984ae
+
8984ae
+qemu-img convert $top_builddir/test-data/phony-guests/windows.img \
8984ae
+         -O vmdk $d/$vmdk
8984ae
+cp "$srcdir/$ovf" $d/$ovf
8984ae
+sha1=`do_sha1 $d/$ovf`
8984ae
+echo "SHA1($ovf)= $sha1" > $d/$mf
8984ae
+sha256=`do_sha256 $d/$vmdk`
8984ae
+echo "SHA256($vmdk)= $sha256" >> $d/$mf
8984ae
+
8984ae
+$VG virt-v2v --debug-gc \
8984ae
+    -i ova $d \
8984ae
+    -o null
8984ae
+
8984ae
+rm -rf $d
8984ae
-- 
8984ae
2.31.1
8984ae