]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: add tests for [u]mount regular file
authorKarel Zak <kzak@redhat.com>
Mon, 21 Feb 2011 14:12:30 +0000 (15:12 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 18 Apr 2011 12:33:02 +0000 (14:33 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
tests/expected/mount/regfile [new file with mode: 0644]
tests/ts/mount/regfile [new file with mode: 0755]

diff --git a/tests/expected/mount/regfile b/tests/expected/mount/regfile
new file mode 100644 (file)
index 0000000..3582111
--- /dev/null
@@ -0,0 +1 @@
+Success
diff --git a/tests/ts/mount/regfile b/tests/ts/mount/regfile
new file mode 100755 (executable)
index 0000000..270bebd
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+# Copyright (C) 2011 Karel Zak <kzak@redhat.com>
+# This file is part of util-linux.
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="regular file"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+set -o pipefail
+
+IMAGE=$(ts_image_init)
+mkfs.ext3 -F $IMAGE &> /dev/null || ts_die "Cannot make ext3 on $IMAGE"
+
+[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
+
+$TS_CMD_MOUNT $IMAGE $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
+
+grep -q "$TS_MOUNTPOINT" /proc/mounts || ts_die "Cannot found $TS_MOUNTPOINT in /proc/mounts"
+
+$TS_CMD_UMOUNT $IMAGE || ts_die "Cannot umount $IMAGE"
+
+grep -q "$TS_MOUNTPOINT" /proc/mounts && ts_die "$TS_MOUNTPOINT still in /proc/mounts"
+
+ts_log "Success"
+ts_finalize
+