Check that we properly handle fstab entries of the form /dev/md0 and
/dev/md/foo.
---
regressions/Makefile.am | 1 +
regressions/test-inspect-fstab-md.sh | 65 ++++++++++++++++++++++++++++++++++
2 files changed, 66 insertions(+), 0 deletions(-)
create mode 100755 regressions/test-inspect-fstab-md.sh
diff --git a/regressions/Makefile.am b/regressions/Makefile.am
index c75d54a..e7ebc6f 100644
--- a/regressions/Makefile.am
+++ b/regressions/Makefile.am
@@ -44,6 +44,7 @@ TESTS = \
test-guestfish-escapes.sh \
test-guestfish-tilde.sh \
test-inspect-fstab.sh \
+ test-inspect-fstab-md.sh \
test-launch-race.pl \
test-list-filesystems.sh \
test-list-md-devices.sh \
diff --git a/regressions/test-inspect-fstab-md.sh b/regressions/test-inspect-fstab-md.sh
new file mode 100755
index 0000000..d541ef4
--- /dev/null
+++ b/regressions/test-inspect-fstab-md.sh
@@ -0,0 +1,65 @@
+#!/bin/bash -
+# libguestfs
+# Copyright (C) 2011 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 the handling of MD devices specified in /etc/fstab
+
+set -e
+export LANG=C
+
+guestfish=../fish/guestfish
+
+rm -f test1.img test.fstab test.output
+
+# First, test the regular fedora image, which specifies /boot as /dev/md0
+cp ../images/fedora-md1.img test1.img
+cp ../images/fedora-md2.img test2.img
+
+$guestfish -i test[12].img <<'EOF' | sort > test.output
+ exists /boot/grub/grub.conf
+EOF
+
+if [ "$(cat test.output)" != "true" ]; then
+ echo "$0: /boot not correctly mounted (/dev/md0)"
+ exit 1
+fi
+
+# Test inspection when /boot is specfied as /dev/md/boot
+cat <<'EOF' > test.fstab
+/dev/VG/Root / ext2 default 0 0
+/dev/md/boot /boot ext2 default 0 0
+EOF
+
+$guestfish -a test1.img -a test2.img <<'EOF'
+ run
+ mount-options "" /dev/VG/Root /
+ upload test.fstab /etc/fstab
+EOF
+
+$guestfish -i test[12].img <<'EOF' | sort > test.output
+ exists /boot/grub/grub.conf
+EOF
+
+if [ "$(cat test.output)" != "true" ]; then
+ echo "$0: error: /boot not correctly mounted (/dev/md/boot)"
+ cat test.output
+ exit 1
+fi
+
+rm test.fstab
+rm test[12].img
+rm test.output
--
1.7.6.4