blob: 8bd60ea0cab366c2454d899e1d5a8477570977af [file] [log] [blame]
Denis Vlasenko5d624622008-07-08 02:57:40 +00001#!/bin/sh
Denis Vlasenko5d624622008-07-08 02:57:40 +00002# Copyright 2007 by Denys Vlasenko <vda.linux@googlemail.com>
3# Licensed under GPL v2, see file LICENSE for details.
4
Mike Frysingercaa79402009-11-04 18:41:22 -05005. ./testing.sh
Denis Vlasenko5d624622008-07-08 02:57:40 +00006
7test "`id -u`" = 0 || {
8 echo "SKIPPED: must be root to test this"
9 exit 0
10}
11
Denys Vlasenkoc1fc3d32009-07-18 17:22:03 +020012testdir=$PWD/testdir
13
Denys Vlasenko6ae64262009-07-18 16:22:26 +020014dd if=/dev/zero of=mount.image1m count=1 bs=1M 2>/dev/null || { echo "dd error"; exit 1; }
15mkfs.minix -v mount.image1m >/dev/null 2>&1 || { echo "mkfs.minix error"; exit 1; }
Denys Vlasenkoc1fc3d32009-07-18 17:22:03 +020016modprobe minix 2>/dev/null
17mkdir "$testdir" 2>/dev/null
18umount -d "$testdir" 2>/dev/null
Denis Vlasenko5d624622008-07-08 02:57:40 +000019
20# testing "test name" "command" "expected result" "file input" "stdin"
21# file input will be file called "input"
22# test can create a file "actual" instead of writing to stdout
23
24testing "mount -o remount,mand" \
Denis Vlasenkoabe49fa2008-07-11 21:41:14 +000025"mount -o loop mount.image1m $testdir "\
Denis Vlasenko5d624622008-07-08 02:57:40 +000026"&& grep -Fc $testdir </proc/mounts "\
27"&& mount -o remount,mand $testdir "\
28"&& grep -F $testdir </proc/mounts | grep -c '[, ]mand[, ]'" \
29 "1\n""1\n" \
30 "" ""
31
Denys Vlasenkoc1fc3d32009-07-18 17:22:03 +020032umount -d "$testdir"
33rmdir "$testdir"
Denis Vlasenkoabe49fa2008-07-11 21:41:14 +000034rm mount.image1m
Denis Vlasenko5d624622008-07-08 02:57:40 +000035
36exit $FAILCOUNT