[Pkg-libvirt-commits] [libguestfs] 56/65: v2v: generalize test-v2v-i-ova-zip.sh
Hilko Bengen
bengen at moszumanska.debian.org
Tue Apr 21 12:11:11 UTC 2015
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to branch experimental
in repository libguestfs.
commit 454220ab43403ad97f02edcb2b5f71c5d21c0c25
Author: Pino Toscano <ptoscano at redhat.com>
Date: Wed Apr 15 15:24:12 2015 +0200
v2v: generalize test-v2v-i-ova-zip.sh
Rename test-v2v-i-ova-zip.sh (and associated data) to
test-v2v-i-ova-formats, and generalize it a bit so it can test different
compression types for the ova "envelope".
---
v2v/Makefile.am | 8 ++--
...ip.expected => test-v2v-i-ova-formats.expected} | 0
...2v-i-ova-zip.ovf => test-v2v-i-ova-formats.ovf} | 0
...-v2v-i-ova-zip.sh => test-v2v-i-ova-formats.sh} | 45 +++++++++++++++-------
4 files changed, 35 insertions(+), 18 deletions(-)
diff --git a/v2v/Makefile.am b/v2v/Makefile.am
index 887600c..06f8380 100644
--- a/v2v/Makefile.am
+++ b/v2v/Makefile.am
@@ -23,12 +23,12 @@ EXTRA_DIST = \
HACKING README.RHEV-M \
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-i-ova-zip.expected \
- test-v2v-i-ova-zip.ovf \
test-v2v-networks-and-bridges-expected.xml \
test-v2v-networks-and-bridges.xml.in \
virt-v2v.pod
@@ -224,9 +224,9 @@ CLEANFILES += stamp-virt-v2v.pod
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 \
- test-v2v-i-ova-zip.sh
+ test-v2v-i-ova-two-disks.sh
if ENABLE_APPLIANCE
TESTS += \
diff --git a/v2v/test-v2v-i-ova-zip.expected b/v2v/test-v2v-i-ova-formats.expected
similarity index 100%
rename from v2v/test-v2v-i-ova-zip.expected
rename to v2v/test-v2v-i-ova-formats.expected
diff --git a/v2v/test-v2v-i-ova-zip.ovf b/v2v/test-v2v-i-ova-formats.ovf
similarity index 100%
rename from v2v/test-v2v-i-ova-zip.ovf
rename to v2v/test-v2v-i-ova-formats.ovf
diff --git a/v2v/test-v2v-i-ova-zip.sh b/v2v/test-v2v-i-ova-formats.sh
similarity index 64%
rename from v2v/test-v2v-i-ova-zip.sh
rename to v2v/test-v2v-i-ova-formats.sh
index cd1e258..a9b2a96 100755
--- a/v2v/test-v2v-i-ova-zip.sh
+++ b/v2v/test-v2v-i-ova-formats.sh
@@ -1,6 +1,6 @@
#!/bin/bash -
# libguestfs virt-v2v test script
-# Copyright (C) 2014 Red Hat Inc.
+# Copyright (C) 2014-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
@@ -16,13 +16,15 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-# Test -i ova option with a zip file.
+# Test -i ova option with ova file compressed in different ways
unset CDPATH
export LANG=C
set -e
-if [ -n "$SKIP_TEST_V2V_I_OVA_ZIP_SH" ]; then
+formats="tar zip"
+
+if [ -n "$SKIP_TEST_V2V_I_OVA_FORMATS_SH" ]; then
echo "$0: test skipped because environment variable is set"
exit 77
fi
@@ -48,7 +50,7 @@ if ! test -r $virt_tools_data_dir/rhsrvany.exe; then
exit 77
fi
-d=test-v2v-i-ova-zip.d
+d=test-v2v-i-ova-formats.d
rm -rf $d
mkdir $d
@@ -60,18 +62,33 @@ truncate -s 10k disk1.vmdk
sha=`sha1sum disk1.vmdk | awk '{print $1}'`
echo -e "SHA1(disk1.vmdk)=$sha\r" > disk1.mf
-zip -r test ../test-v2v-i-ova-zip.ovf disk1.vmdk disk1.mf
-mv test.zip test.ova
+for format in $formats; do
+ case "$format" in
+ tar)
+ tar -cf test-$format.ova ../test-v2v-i-ova-formats.ovf disk1.vmdk disk1.mf
+ ;;
+ zip)
+ zip -r test ../test-v2v-i-ova-formats.ovf disk1.vmdk disk1.mf
+ mv test.zip test-$format.ova
+ ;;
+ *)
+ echo "Unhandled format '$format'"
+ exit 1
+ esac
+done
+
popd
-# Run virt-v2v but only as far as the --print-source stage, and
-# normalize the output.
-$VG virt-v2v --debug-gc --quiet \
- -i ova $d/test.ova \
- --print-source |
-sed 's,[^ \t]*\(disk.*.vmdk\),\1,' > $d/source
+for format in $formats; do
+ # Run virt-v2v but only as far as the --print-source stage, and
+ # normalize the output.
+ $VG virt-v2v --debug-gc --quiet \
+ -i ova $d/test-$format.ova \
+ --print-source |
+ sed 's,[^ \t]*\(disk.*.vmdk\),\1,' > $d/source
-# Check the parsed source is what we expect.
-diff -u test-v2v-i-ova-zip.expected $d/source
+ # Check the parsed source is what we expect.
+ diff -u test-v2v-i-ova-formats.expected $d/source
+done
rm -rf $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