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

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