diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2011-01-11 10:43:51 +0000 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2011-01-11 11:09:41 +0000 |
commit | 0c60e4d9dd6549c2135699490ba8a9ec1dd50ab9 (patch) | |
tree | 25e5e1f71bb285fd4964bf2c6c1489656e74a241 /regressions | |
parent | fc241abdbac7a016cd2fac169ad64876107df3c8 (diff) | |
download | libguestfs-0c60e4d9dd6549c2135699490ba8a9ec1dd50ab9.tar.gz libguestfs-0c60e4d9dd6549c2135699490ba8a9ec1dd50ab9.tar.xz libguestfs-0c60e4d9dd6549c2135699490ba8a9ec1dd50ab9.zip |
fish: Don't fail if some mountpoints in /etc/fstab are bogus (RHBZ#668574).
Fix guestfish (and other C tools) so that they ignore errors
when /etc/fstab contains bogus entries.
Update the documentation for inspect-get-mountpoints to emphasize
that callers must be aware of this when mounting the returned
values.
Add a regression test.
Update the example code ("inspect_vm") to reflect the way this
API ought to be called.
For more detail see:
https://bugzilla.redhat.com/show_bug.cgi?id=668574
Diffstat (limited to 'regressions')
-rw-r--r-- | regressions/Makefile.am | 1 | ||||
-rwxr-xr-x | regressions/test-inspect-fstab.sh | 70 |
2 files changed, 71 insertions, 0 deletions
diff --git a/regressions/Makefile.am b/regressions/Makefile.am index c1dedcd9..844bdfe1 100644 --- a/regressions/Makefile.am +++ b/regressions/Makefile.am @@ -39,6 +39,7 @@ TESTS = \ test-guestfish-a.sh \ test-guestfish-d.sh \ test-guestfish-tilde.sh \ + test-inspect-fstab.sh \ test-launch-race.pl \ test-luks.sh \ test-lvm-filtering.sh \ diff --git a/regressions/test-inspect-fstab.sh b/regressions/test-inspect-fstab.sh new file mode 100755 index 00000000..fb284152 --- /dev/null +++ b/regressions/test-inspect-fstab.sh @@ -0,0 +1,70 @@ +#!/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., 675 Mass Ave, Cambridge, MA 02139, USA. + +# Test various aspects of core inspection of /etc/fstab. +# This also tests: https://bugzilla.redhat.com/668574 + +set -e +export LANG=C + +guestfish=../fish/guestfish + +rm -f test1.img test.fstab test.output + +# Start with the regular (good) fedora image, modify /etc/fstab +# and then inspect it. +cp ../images/fedora.img test1.img + +cat <<'EOF' > test.fstab +/dev/VG/Root / ext2 default 0 0 + +# Xen-style partition names. +/dev/xvda1 /boot ext2 default 0 0 + +# Non-existant device. +/dev/sdb3 /var ext2 default 0 0 + +# Non-existant mountpoint. +/dev/VG/LV1 /nosuchfile ext2 default 0 0 +EOF + +$guestfish -a test1.img <<'EOF' + run + mount-options "" /dev/VG/Root / + upload test.fstab /etc/fstab +EOF + +rm test.fstab + +# This will give a warning, but should not fail. +$guestfish -a test1.img -i <<'EOF' | sort > test.output + inspect-get-mountpoints /dev/VG/Root +EOF + +rm test1.img + +if [ "$(cat test.output)" != "/: /dev/VG/Root +/boot: /dev/vda1 +/nosuchfile: /dev/VG/LV1 +/var: /dev/sdb3" ]; then + echo "$0: error: unexpected output from inspect-get-mountpoints command" + cat test.output + exit 1 +fi + +rm test.output |