2 # Copyright 2007 by Denys Vlasenko <vda.linux@googlemail.com>
3 # Licensed under GPLv2, see file LICENSE in this source tree.
6 test -f "$bindir/.config" && . "$bindir/.config"
8 test "`id -u`" = 0 || {
9 echo "SKIPPED: mount (must be root to test this)"
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" \
23 testdir="$PWD/mount.testdir"
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
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
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[, ]'" \
48 # Bug: mount.shared1 directory shows no files (has to show files a and b)
49 testing "mount bind+rshared" "\
50 mkdir -p mount.dir mount.shared1 mount.shared2
51 touch mount.dir/a mount.dir/b
53 mount --bind mount.shared1 mount.shared1 2>&1
54 mount --make-rshared mount.shared1 2>&1
55 mount --bind mount.shared2 mount.shared2 2>&1
56 mount --make-rshared mount.shared2 2>&1
58 mount --bind mount.shared2 mount.shared1 2>&1
59 mount --bind mount.dir mount.shared2 2>&1
61 ls -R mount.dir mount.shared1 mount.shared2 2>&1
63 umount mount.dir mount.shared1 mount.shared2 2>/dev/null
64 umount mount.dir mount.shared1 mount.shared2 2>/dev/null
65 umount mount.dir mount.shared1 mount.shared2 2>/dev/null
66 rm -f mount.dir/a mount.dir/b mount.dir/c
67 rmdir mount.dir mount.shared1 mount.shared2