[Libguestfs] [PATCH virt-v2v 3/3] tests: Add test cases for converting the phony Fedora images

Laszlo Ersek lersek at redhat.com
Thu Jun 9 08:20:47 UTC 2022


On 06/08/22 18:49, Richard W.M. Jones wrote:
> 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.
> ---
>  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(+)
> 
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index 1244279836..63e654a3d1 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -96,6 +96,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) \
> @@ -171,6 +175,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 \

Under TESTS, you insert the new shell script names between
"test-v2v-virtio-win-iso.sh" and "test-v2v-windows-conversion.sh". The
same would be possible under EXTRA_DIST too, but there you go with
alphabetical odering (AFAICT). Conversely, the lexicographical ordering
(placement between cdrom and floppy) would be possible under TESTS.

Is this difference intentional?

> diff --git a/tests/test-v2v-fedora-btrfs-conversion.sh b/tests/test-v2v-fedora-btrfs-conversion.sh
> new file mode 100755
> index 0000000000..c78f8ae246
> --- /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 0000000000..92f4bbe8ea
> --- /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 0000000000..2922c31da1
> --- /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 0000000000..669f2c01b5
> --- /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
> 

Acked-by: Laszlo Ersek <lersek at redhat.com>

Thanks
Laszlo


More information about the Libguestfs mailing list