]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: add mount(8) test for fstab entries without options
authorKarel Zak <kzak@redhat.com>
Wed, 11 May 2011 15:55:10 +0000 (17:55 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 11 May 2011 15:55:10 +0000 (17:55 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
tests/expected/mount/fstab-broken [new file with mode: 0644]
tests/expected/mount/fstab-broken-mount [new file with mode: 0644]
tests/expected/mount/fstab-broken-mount-all [new file with mode: 0644]
tests/ts/mount/fstab-broken [new file with mode: 0755]

diff --git a/tests/expected/mount/fstab-broken b/tests/expected/mount/fstab-broken
new file mode 100644 (file)
index 0000000..3582111
--- /dev/null
@@ -0,0 +1 @@
+Success
diff --git a/tests/expected/mount/fstab-broken-mount b/tests/expected/mount/fstab-broken-mount
new file mode 100644 (file)
index 0000000..d86bac9
--- /dev/null
@@ -0,0 +1 @@
+OK
diff --git a/tests/expected/mount/fstab-broken-mount-all b/tests/expected/mount/fstab-broken-mount-all
new file mode 100644 (file)
index 0000000..d86bac9
--- /dev/null
@@ -0,0 +1 @@
+OK
diff --git a/tests/ts/mount/fstab-broken b/tests/ts/mount/fstab-broken
new file mode 100755 (executable)
index 0000000..c256e02
--- /dev/null
@@ -0,0 +1,63 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file 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 file 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.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="broken fstab"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+set -o pipefail
+
+# Let's use the same mountpoint for all subtests
+MNT=$TS_MOUNTPOINT
+mkdir -p $MNT
+
+ts_fstab_open
+echo "tmpd $MNT tmpfs" >> /etc/fstab
+ts_fstab_close
+
+
+ts_init_subtest "mount"
+$TS_CMD_MOUNT $MNT &> /dev/null
+$TS_CMD_FINDMNT --kernel --target "$MNT" &> /dev/null
+if [ "$?" != "0" ]; then
+       ts_log "Cannot found $MNT in /proc/self/mountinfo"
+else
+       ts_log "OK"
+fi
+$TS_CMD_UMOUNT $MNT &> /dev/null
+ts_finalize_subtest
+
+
+ts_init_subtest "mount-all"
+$TS_CMD_MOUNT -a &> /dev/null
+$TS_CMD_FINDMNT --kernel --target "$MNT" &> /dev/null
+if [ "$?" != "0" ]; then
+       ts_log "Cannot found $MNT in /proc/self/mountinfo"
+else
+       ts_log "OK"
+fi
+$TS_CMD_UMOUNT $MNT &> /dev/null
+ts_finalize_subtest
+
+ts_fstab_clean
+
+ts_log "Success"
+ts_finalize
+