Denis Vlasenko | 5d62462 | 2008-07-08 02:57:40 +0000 | [diff] [blame] | 1 | #!/bin/sh |
Denis Vlasenko | 5d62462 | 2008-07-08 02:57:40 +0000 | [diff] [blame] | 2 | # Copyright 2007 by Denys Vlasenko <vda.linux@googlemail.com> |
Denys Vlasenko | 0ef64bd | 2010-08-16 20:14:46 +0200 | [diff] [blame] | 3 | # Licensed under GPLv2, see file LICENSE in this source tree. |
Denis Vlasenko | 5d62462 | 2008-07-08 02:57:40 +0000 | [diff] [blame] | 4 | |
Mike Frysinger | caa7940 | 2009-11-04 18:41:22 -0500 | [diff] [blame] | 5 | . ./testing.sh |
Denys Vlasenko | bfa1b2e | 2010-05-11 03:53:57 +0200 | [diff] [blame] | 6 | test -f "$bindir/.config" && . "$bindir/.config" |
| 7 | |
Denis Vlasenko | 5d62462 | 2008-07-08 02:57:40 +0000 | [diff] [blame] | 8 | test "`id -u`" = 0 || { |
Denys Vlasenko | bfa1b2e | 2010-05-11 03:53:57 +0200 | [diff] [blame] | 9 | echo "SKIPPED: mount (must be root to test this)" |
Denis Vlasenko | 5d62462 | 2008-07-08 02:57:40 +0000 | [diff] [blame] | 10 | exit 0 |
| 11 | } |
| 12 | |
Denys Vlasenko | bfa1b2e | 2010-05-11 03:53:57 +0200 | [diff] [blame] | 13 | if test x"$CONFIG_MKFS_MINIX" != x"y" \ |
| 14 | || test x"$CONFIG_FEATURE_MINIX2" != x"y" \ |
Denys Vlasenko | c0211e9 | 2010-05-11 04:32:04 +0200 | [diff] [blame] | 15 | || test x"$CONFIG_FEATURE_MOUNT_LOOP" != x"y" \ |
Denys Vlasenko | da13824 | 2010-05-11 12:02:48 +0200 | [diff] [blame] | 16 | || test x"$CONFIG_FEATURE_MOUNT_FLAGS" != x"y" \ |
Denys Vlasenko | bfa1b2e | 2010-05-11 03:53:57 +0200 | [diff] [blame] | 17 | || test x"$CONFIG_FEATURE_DEVFS" = x"y" \ |
| 18 | ; then |
| 19 | echo "SKIPPED: mount" |
| 20 | exit 0 |
Chris Metcalf | 208d35d | 2010-04-02 09:57:27 +0200 | [diff] [blame] | 21 | fi |
| 22 | |
Denys Vlasenko | c2fda86 | 2011-03-14 06:28:28 +0100 | [diff] [blame] | 23 | testdir="$PWD/mount.testdir" |
Denys Vlasenko | c1fc3d3 | 2009-07-18 17:22:03 +0200 | [diff] [blame] | 24 | |
Denys Vlasenko | 6ae6426 | 2009-07-18 16:22:26 +0200 | [diff] [blame] | 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; } |
Denys Vlasenko | c1fc3d3 | 2009-07-18 17:22:03 +0200 | [diff] [blame] | 27 | modprobe minix 2>/dev/null |
| 28 | mkdir "$testdir" 2>/dev/null |
| 29 | umount -d "$testdir" 2>/dev/null |
Denis Vlasenko | 5d62462 | 2008-07-08 02:57:40 +0000 | [diff] [blame] | 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" \ |
Denis Vlasenko | abe49fa | 2008-07-11 21:41:14 +0000 | [diff] [blame] | 36 | "mount -o loop mount.image1m $testdir "\ |
Denis Vlasenko | 5d62462 | 2008-07-08 02:57:40 +0000 | [diff] [blame] | 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 | |
Denys Vlasenko | c1fc3d3 | 2009-07-18 17:22:03 +0200 | [diff] [blame] | 43 | umount -d "$testdir" |
| 44 | rmdir "$testdir" |
Denis Vlasenko | abe49fa | 2008-07-11 21:41:14 +0000 | [diff] [blame] | 45 | rm mount.image1m |
Denis Vlasenko | 5d62462 | 2008-07-08 02:57:40 +0000 | [diff] [blame] | 46 | |
Denys Vlasenko | c2fda86 | 2011-03-14 06:28:28 +0100 | [diff] [blame] | 47 | |
| 48 | # Bug: mount.shared1 directory shows no files (has to show files a and b) |
Denys Vlasenko | 47b0336 | 2011-08-10 10:45:48 +0200 | [diff] [blame] | 49 | optional FEATURE_LS_RECURSIVE FEATURE_LS_SORTFILES |
Denys Vlasenko | c2fda86 | 2011-03-14 06:28:28 +0100 | [diff] [blame] | 50 | testing "mount bind+rshared" "\ |
| 51 | mkdir -p mount.dir mount.shared1 mount.shared2 |
| 52 | touch mount.dir/a mount.dir/b |
| 53 | |
| 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 |
| 58 | |
| 59 | mount --bind mount.shared2 mount.shared1 2>&1 |
| 60 | mount --bind mount.dir mount.shared2 2>&1 |
| 61 | |
| 62 | ls -R mount.dir mount.shared1 mount.shared2 2>&1 |
| 63 | |
| 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 | " \ |
| 70 | "\ |
| 71 | mount.dir: |
| 72 | a |
| 73 | b |
| 74 | |
| 75 | mount.shared1: |
| 76 | a |
| 77 | b |
| 78 | |
| 79 | mount.shared2: |
| 80 | a |
| 81 | b |
| 82 | " \ |
| 83 | "" "" |
Denys Vlasenko | b47b3ce | 2011-08-10 00:51:29 +0200 | [diff] [blame] | 84 | SKIP= |
Denys Vlasenko | c2fda86 | 2011-03-14 06:28:28 +0100 | [diff] [blame] | 85 | |
Denis Vlasenko | 5d62462 | 2008-07-08 02:57:40 +0000 | [diff] [blame] | 86 | exit $FAILCOUNT |