1 | #!/bin/sh
|
---|
2 | # Copyright 2007 by Denys Vlasenko <vda.linux@googlemail.com>
|
---|
3 | # Licensed under GPLv2, see file LICENSE in this source tree.
|
---|
4 |
|
---|
5 | . ./testing.sh
|
---|
6 | test -f "$bindir/.config" && . "$bindir/.config"
|
---|
7 |
|
---|
8 | test "`id -u`" = 0 || {
|
---|
9 | echo "SKIPPED: mount (must be root to test this)"
|
---|
10 | exit 0
|
---|
11 | }
|
---|
12 |
|
---|
13 | if test x"$CONFIG_MKFS_MINIX" != x"y" \
|
---|
14 | || test x"$CONFIG_FEATURE_MINIX2" != x"y" \
|
---|
15 | || test x"$CONFIG_FEATURE_MOUNT_LOOP" != x"y" \
|
---|
16 | || test x"$CONFIG_FEATURE_MOUNT_FLAGS" != x"y" \
|
---|
17 | || test x"$CONFIG_FEATURE_DEVFS" = x"y" \
|
---|
18 | ; then
|
---|
19 | echo "SKIPPED: mount"
|
---|
20 | exit 0
|
---|
21 | fi
|
---|
22 |
|
---|
23 | testdir=$PWD/mount.testdir
|
---|
24 |
|
---|
25 | dd if=/dev/zero of=mount.image1m count=1 bs=1M 2>/dev/null || { echo "dd error"; exit 1; }
|
---|
26 | mkfs.minix -v mount.image1m >/dev/null 2>&1 || { echo "mkfs.minix error"; exit 1; }
|
---|
27 | modprobe minix 2>/dev/null
|
---|
28 | mkdir "$testdir" 2>/dev/null
|
---|
29 | umount -d "$testdir" 2>/dev/null
|
---|
30 |
|
---|
31 | # testing "test name" "command" "expected result" "file input" "stdin"
|
---|
32 | # file input will be file called "input"
|
---|
33 | # test can create a file "actual" instead of writing to stdout
|
---|
34 |
|
---|
35 | testing "mount -o remount,mand" \
|
---|
36 | "mount -o loop mount.image1m $testdir "\
|
---|
37 | "&& grep -Fc $testdir </proc/mounts "\
|
---|
38 | "&& mount -o remount,mand $testdir "\
|
---|
39 | "&& grep -F $testdir </proc/mounts | grep -c '[, ]mand[, ]'" \
|
---|
40 | "1\n""1\n" \
|
---|
41 | "" ""
|
---|
42 |
|
---|
43 | umount -d "$testdir"
|
---|
44 | rmdir "$testdir"
|
---|
45 | rm mount.image1m
|
---|
46 |
|
---|
47 | exit $FAILCOUNT
|
---|