From 34e04554158afb85ee6b5baebe2a9b18e0b34c86 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Wed, 8 Jun 2022 17:31:24 +0100 Subject: [PATCH] tests: Add test cases for converting the phony Fedora images As well as testing a full Fedora conversion which was not really tested properly before, this also adds tests of conversions of Btrfs, RAID and LUKS guests. (cherry picked from commit 3600f81ec5b584cbdc3f1d33a7a42bbc014e2412) --- tests/Makefile.am | 8 ++++++ tests/test-v2v-fedora-btrfs-conversion.sh | 31 +++++++++++++++++++++ tests/test-v2v-fedora-conversion.sh | 31 +++++++++++++++++++++ tests/test-v2v-fedora-luks-conversion.sh | 32 ++++++++++++++++++++++ tests/test-v2v-fedora-md-conversion.sh | 33 +++++++++++++++++++++++ 5 files changed, 135 insertions(+) create mode 100755 tests/test-v2v-fedora-btrfs-conversion.sh create mode 100755 tests/test-v2v-fedora-conversion.sh create mode 100755 tests/test-v2v-fedora-luks-conversion.sh create mode 100755 tests/test-v2v-fedora-md-conversion.sh diff --git a/tests/Makefile.am b/tests/Makefile.am index 549d39e1..eb2931c5 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -95,6 +95,10 @@ TESTS = \ test-v2v-print-source.sh \ test-v2v-sound.sh \ test-v2v-virtio-win-iso.sh \ + test-v2v-fedora-conversion.sh \ + test-v2v-fedora-btrfs-conversion.sh \ + test-v2v-fedora-luks-conversion.sh \ + test-v2v-fedora-md-conversion.sh \ test-v2v-windows-conversion.sh \ rhbz1232192.sh \ $(SLOW_TESTS) \ @@ -170,6 +174,10 @@ EXTRA_DIST += \ test-v2v-bad-networks-and-bridges.sh \ test-v2v-cdrom.expected \ test-v2v-cdrom.sh \ + test-v2v-fedora-conversion.sh \ + test-v2v-fedora-btrfs-conversion.sh \ + test-v2v-fedora-luks-conversion.sh \ + test-v2v-fedora-md-conversion.sh \ test-v2v-floppy.expected \ test-v2v-floppy.sh \ test-v2v-i-disk.sh \ diff --git a/tests/test-v2v-fedora-btrfs-conversion.sh b/tests/test-v2v-fedora-btrfs-conversion.sh new file mode 100755 index 00000000..c78f8ae2 --- /dev/null +++ b/tests/test-v2v-fedora-btrfs-conversion.sh @@ -0,0 +1,31 @@ +#!/bin/bash - +# libguestfs virt-v2v test script +# Copyright (C) 2014-2022 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 virt-v2v (Phony) Fedora conversion. + +set -e + +source ./functions.sh +set -e +set -x + +skip_if_skipped +f=../test-data/phony-guests/fedora-btrfs.img +requires test -f $f + +$VG virt-v2v --debug-gc -i disk $f -o null diff --git a/tests/test-v2v-fedora-conversion.sh b/tests/test-v2v-fedora-conversion.sh new file mode 100755 index 00000000..92f4bbe8 --- /dev/null +++ b/tests/test-v2v-fedora-conversion.sh @@ -0,0 +1,31 @@ +#!/bin/bash - +# libguestfs virt-v2v test script +# Copyright (C) 2014-2022 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 virt-v2v (Phony) Fedora conversion. + +set -e + +source ./functions.sh +set -e +set -x + +skip_if_skipped +f=../test-data/phony-guests/fedora.img +requires test -f $f + +$VG virt-v2v --debug-gc -i disk $f -o null diff --git a/tests/test-v2v-fedora-luks-conversion.sh b/tests/test-v2v-fedora-luks-conversion.sh new file mode 100755 index 00000000..2922c31d --- /dev/null +++ b/tests/test-v2v-fedora-luks-conversion.sh @@ -0,0 +1,32 @@ +#!/bin/bash - +# libguestfs virt-v2v test script +# Copyright (C) 2014-2022 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 virt-v2v (Phony) Fedora conversion. + +set -e + +source ./functions.sh +set -e +set -x + +skip_if_skipped +f=../test-data/phony-guests/fedora-luks.img +requires test -f $f + +# The disk is encrypted with password "FEDORA". +$VG virt-v2v --debug-gc -i disk $f -o null --key /dev/sda2:key:FEDORA diff --git a/tests/test-v2v-fedora-md-conversion.sh b/tests/test-v2v-fedora-md-conversion.sh new file mode 100755 index 00000000..669f2c01 --- /dev/null +++ b/tests/test-v2v-fedora-md-conversion.sh @@ -0,0 +1,33 @@ +#!/bin/bash - +# libguestfs virt-v2v test script +# Copyright (C) 2014-2022 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 virt-v2v (Phony) Fedora conversion. + +set -e + +source ./functions.sh +set -e +set -x + +skip_if_skipped +f1=../test-data/phony-guests/fedora-md1.img +requires test -f $f1 +f2=../test-data/phony-guests/fedora-md2.img +requires test -f $f2 + +$VG virt-v2v --debug-gc -i disk $f1 $f2 -o null -- 2.31.1