blob: 3c7405fbd531525a0f5e40831894366d0f56dd9c [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
Denys Vlasenkobfa1b2e2010-05-11 03:53:57 +02007test -f "$bindir/.config" && . "$bindir/.config"
8
Denis Vlasenko5d624622008-07-08 02:57:40 +00009test "`id -u`" = 0 || {
Denys Vlasenkobfa1b2e2010-05-11 03:53:57 +020010 echo "SKIPPED: mount (must be root to test this)"
Denis Vlasenko5d624622008-07-08 02:57:40 +000011 exit 0
12}
13
Denys Vlasenkobfa1b2e2010-05-11 03:53:57 +020014if test x"$CONFIG_MKFS_MINIX" != x"y" \
15|| test x"$CONFIG_FEATURE_MINIX2" != x"y" \
Denys Vlasenkoc0211e92010-05-11 04:32:04 +020016|| test x"$CONFIG_FEATURE_MOUNT_LOOP" != x"y" \
Denys Vlasenkoda138242010-05-11 12:02:48 +020017|| test x"$CONFIG_FEATURE_MOUNT_FLAGS" != x"y" \
Denys Vlasenkobfa1b2e2010-05-11 03:53:57 +020018|| test x"$CONFIG_FEATURE_DEVFS" = x"y" \
19; then
20 echo "SKIPPED: mount"
21 exit 0
Chris Metcalf208d35d2010-04-02 09:57:27 +020022fi
23
Denys Vlasenkoda138242010-05-11 12:02:48 +020024testdir=$PWD/mount.testdir
Denys Vlasenkoc1fc3d32009-07-18 17:22:03 +020025
Denys Vlasenko6ae64262009-07-18 16:22:26 +020026dd if=/dev/zero of=mount.image1m count=1 bs=1M 2>/dev/null || { echo "dd error"; exit 1; }
27mkfs.minix -v mount.image1m >/dev/null 2>&1 || { echo "mkfs.minix error"; exit 1; }
Denys Vlasenkoc1fc3d32009-07-18 17:22:03 +020028modprobe minix 2>/dev/null
29mkdir "$testdir" 2>/dev/null
30umount -d "$testdir" 2>/dev/null
Denis Vlasenko5d624622008-07-08 02:57:40 +000031
32# testing "test name" "command" "expected result" "file input" "stdin"
33# file input will be file called "input"
34# test can create a file "actual" instead of writing to stdout
35
36testing "mount -o remount,mand" \
Denis Vlasenkoabe49fa2008-07-11 21:41:14 +000037"mount -o loop mount.image1m $testdir "\
Denis Vlasenko5d624622008-07-08 02:57:40 +000038"&& grep -Fc $testdir </proc/mounts "\
39"&& mount -o remount,mand $testdir "\
40"&& grep -F $testdir </proc/mounts | grep -c '[, ]mand[, ]'" \
41 "1\n""1\n" \
42 "" ""
43
Denys Vlasenkoc1fc3d32009-07-18 17:22:03 +020044umount -d "$testdir"
45rmdir "$testdir"
Denis Vlasenkoabe49fa2008-07-11 21:41:14 +000046rm mount.image1m
Denis Vlasenko5d624622008-07-08 02:57:40 +000047
48exit $FAILCOUNT