From: Karel Zak Date: Mon, 21 Feb 2011 14:12:30 +0000 (+0100) Subject: tests: add tests for [u]mount regular file X-Git-Tag: v2.20-rc1~536 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1201340290674e81816630bc53a968095c47b9d5;p=thirdparty%2Futil-linux.git tests: add tests for [u]mount regular file Signed-off-by: Karel Zak --- diff --git a/tests/expected/mount/regfile b/tests/expected/mount/regfile new file mode 100644 index 0000000000..35821117c8 --- /dev/null +++ b/tests/expected/mount/regfile @@ -0,0 +1 @@ +Success diff --git a/tests/ts/mount/regfile b/tests/ts/mount/regfile new file mode 100755 index 0000000000..270bebd2d1 --- /dev/null +++ b/tests/ts/mount/regfile @@ -0,0 +1,30 @@ +#!/bin/bash + +# Copyright (C) 2011 Karel Zak +# 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 +