mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
rescue: Add a regression test for virt-rescue --suggest option.
This commit is contained in:
@@ -19,6 +19,7 @@ include $(top_srcdir)/subdir-rules.mk
|
||||
|
||||
EXTRA_DIST = \
|
||||
test-virt-rescue.pl \
|
||||
test-virt-rescue-suggest.sh \
|
||||
virt-rescue.pod
|
||||
|
||||
CLEANFILES = stamp-virt-rescue.pod
|
||||
@@ -78,6 +79,13 @@ stamp-virt-rescue.pod: virt-rescue.pod
|
||||
|
||||
TESTS_ENVIRONMENT = $(top_builddir)/run --test
|
||||
|
||||
TESTS =
|
||||
|
||||
if ENABLE_APPLIANCE
|
||||
TESTS = test-virt-rescue.pl
|
||||
TESTS += \
|
||||
test-virt-rescue.pl \
|
||||
test-virt-rescue-suggest.sh
|
||||
endif ENABLE_APPLIANCE
|
||||
|
||||
check-valgrind:
|
||||
$(MAKE) TESTS="test-virt-rescue-suggest.sh" VG="$(top_builddir)/run @VG@" check
|
||||
|
||||
43
rescue/test-virt-rescue-suggest.sh
Executable file
43
rescue/test-virt-rescue-suggest.sh
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/bin/bash -
|
||||
# test virt-rescue --suggest
|
||||
# Copyright (C) 2014 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.
|
||||
|
||||
export LANG=C
|
||||
set -e
|
||||
|
||||
guest=../tests/guests/fedora.img
|
||||
|
||||
if [ ! -s "$guest" ]; then
|
||||
echo "$0: test skipped because $guest does not exist or is an empty file"
|
||||
exit 77
|
||||
fi
|
||||
|
||||
rm -f virt-rescue-suggest.out
|
||||
|
||||
$VG ./virt-rescue --suggest "$guest" > virt-rescue-suggest.out
|
||||
if [ "$(grep '^mount ' virt-rescue-suggest.out)" != "mount /dev/VG/Root /sysroot/
|
||||
mount /dev/sda1 /sysroot/boot
|
||||
mount --bind /dev /sysroot/dev
|
||||
mount --bind /dev/pts /sysroot/dev/pts
|
||||
mount --bind /proc /sysroot/proc
|
||||
mount --bind /sys /sysroot/sys" ]; then
|
||||
echo "$0: unexpected output from virt-rescue --suggest command:"
|
||||
cat virt-rescue-suggest.out
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm virt-rescue-suggest.out
|
||||
Reference in New Issue
Block a user