summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-02-13 13:48:02 +0000
committerRichard W.M. Jones <rjones@redhat.com>2012-02-13 13:49:21 +0000
commitcd06ddf4422a31528f4a268dad813938947e1a0d (patch)
tree174c64d3c1f90fc72d6b2eaf2f5f41f16da0dceb
parent1b15e543a8efee027451dcfb68743d35eda95dfc (diff)
downloadlibguestfs-cd06ddf4422a31528f4a268dad813938947e1a0d.tar.gz
libguestfs-cd06ddf4422a31528f4a268dad813938947e1a0d.tar.xz
libguestfs-cd06ddf4422a31528f4a268dad813938947e1a0d.zip
tests: Add a regression test for RHBZ#789960.
Test all the ways that the 'mount' command can fail. Ensure that none of them result in failures or desynchronization.
-rw-r--r--tests/regressions/Makefile.am1
-rwxr-xr-xtests/regressions/rhbz789960.sh68
2 files changed, 69 insertions, 0 deletions
diff --git a/tests/regressions/Makefile.am b/tests/regressions/Makefile.am
index 97e0e671..3aed6008 100644
--- a/tests/regressions/Makefile.am
+++ b/tests/regressions/Makefile.am
@@ -26,6 +26,7 @@ TESTS = \
rhbz580246.sh \
rhbz602997.sh \
rhbz690819.sh \
+ rhbz789960.sh \
test-noexec-stack.pl
tests_not_run = \
diff --git a/tests/regressions/rhbz789960.sh b/tests/regressions/rhbz789960.sh
new file mode 100755
index 00000000..b1d59343
--- /dev/null
+++ b/tests/regressions/rhbz789960.sh
@@ -0,0 +1,68 @@
+#!/bin/bash -
+# libguestfs
+# Copyright (C) 2012 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.
+
+# https://bugzilla.redhat.com/show_bug.cgi?id=789960
+# Test the mount command error paths.
+
+set -e
+export LANG=C
+
+rm -f test.out
+
+../../fish/guestfish -a ../guests/fedora.img --ro > test.out <<EOF
+run
+
+# Not a device at all, should fail.
+-mount /foo /
+
+# Not a block device.
+-mount /dev/null /
+
+# Should fail even though the device exists.
+-mount /dev/sda /
+
+# In some configurations, this is the febootstrap appliance. This
+# should fail.
+-mount /dev/vdb /
+
+# Check device name translation. These are all expected to fail.
+-mount /dev/vda /
+-mount /dev/hda /
+
+# Not a mount point.
+-mount /dev/sda1 /foo
+
+# Nothing should be mounted here.
+mountpoints
+
+# This should succeed.
+mount /dev/sda1 /
+
+# Daemon should be up.
+ping-daemon
+echo done
+
+EOF
+
+if [ "$(cat test.out)" != "done" ]; then
+ echo "$0: unexpected output:"
+ cat test.out
+ exit 1
+fi
+
+rm -f test.out