Changes for kernel and Busybox
[tomato.git] / release / src / router / busybox / testsuite / mount.tests
blobc5891be836aaea980d144e6e5049dde4e025107c
1 #!/bin/sh
2 # Copyright 2007 by Denys Vlasenko <vda.linux@googlemail.com>
3 # Licensed under GPLv2, see file LICENSE in this source tree.
5 . ./testing.sh
6 test -f "$bindir/.config" && . "$bindir/.config"
8 test "`id -u`" = 0 || {
9 echo "SKIPPED: mount (must be root to test this)"
10 exit 0
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
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[, ]'" \
40 "1\n""1\n" \
41 "" ""
43 umount -d "$testdir"
44 rmdir "$testdir"
45 rm mount.image1m
48 # Bug: mount.shared1 directory shows no files (has to show files a and b)
49 optional FEATURE_LS_RECURSIVE FEATURE_LS_SORTFILES
50 testing "mount bind+rshared" "\
51 mkdir -p mount.dir mount.shared1 mount.shared2
52 touch mount.dir/a mount.dir/b
54 mount --bind mount.shared1 mount.shared1 2>&1
55 mount --make-rshared mount.shared1 2>&1
56 mount --bind mount.shared2 mount.shared2 2>&1
57 mount --make-rshared mount.shared2 2>&1
59 mount --bind mount.shared2 mount.shared1 2>&1
60 mount --bind mount.dir mount.shared2 2>&1
62 ls -R mount.dir mount.shared1 mount.shared2 2>&1
64 umount mount.dir mount.shared1 mount.shared2 2>/dev/null
65 umount mount.dir mount.shared1 mount.shared2 2>/dev/null
66 umount mount.dir mount.shared1 mount.shared2 2>/dev/null
67 rm -f mount.dir/a mount.dir/b mount.dir/c
68 rmdir mount.dir mount.shared1 mount.shared2
69 " \
71 mount.dir:
75 mount.shared1:
79 mount.shared2:
82 " \
83 "" ""
84 SKIP=
86 exit $FAILCOUNT