diff --git a/tests/md/Makefile.am b/tests/md/Makefile.am index 96d2daf80..f6c5c48b4 100644 --- a/tests/md/Makefile.am +++ b/tests/md/Makefile.am @@ -22,6 +22,7 @@ TESTS = \ test-inspect-fstab-md.sh \ test-list-filesystems.sh \ test-list-md-devices.sh \ + test-lvm-on-md-device.sh \ test-mdadm.sh TESTS_ENVIRONMENT = $(top_builddir)/run --test diff --git a/tests/md/test-lvm-on-md-device.sh b/tests/md/test-lvm-on-md-device.sh new file mode 100755 index 000000000..4c341de5c --- /dev/null +++ b/tests/md/test-lvm-on-md-device.sh @@ -0,0 +1,80 @@ +#!/bin/bash - +# libguestfs +# Copyright (C) 2018 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 guestfish finds logical volume (LV) created on md device + +set -e + +$TEST_FUNCTIONS +skip_if_skipped + +disk1=lvm-on-md-devices-1.img +disk2=lvm-on-md-devices-2.img + +rm -f $disk1 $disk2 + +# Clean up if the script is killed or exits early +cleanup () +{ + status=$? + set +e + + # Don't delete the output files if non-zero exit + if [ "$status" -eq 0 ]; then rm -f $disk1 $disk2; fi + + exit $status +} +trap cleanup INT QUIT TERM EXIT + +guestfish <