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> |
| 3 | # Licensed under GPL v2, see file LICENSE for details. |
| 4 | |
Mike Frysinger | caa7940 | 2009-11-04 18:41:22 -0500 | [diff] [blame] | 5 | . ./testing.sh |
Denis Vlasenko | 5d62462 | 2008-07-08 02:57:40 +0000 | [diff] [blame] | 6 | |
Denys Vlasenko | bfa1b2e | 2010-05-11 03:53:57 +0200 | [diff] [blame] | 7 | test -f "$bindir/.config" && . "$bindir/.config" |
| 8 | |
Denis Vlasenko | 5d62462 | 2008-07-08 02:57:40 +0000 | [diff] [blame] | 9 | test "`id -u`" = 0 || { |
Denys Vlasenko | bfa1b2e | 2010-05-11 03:53:57 +0200 | [diff] [blame] | 10 | echo "SKIPPED: mount (must be root to test this)" |
Denis Vlasenko | 5d62462 | 2008-07-08 02:57:40 +0000 | [diff] [blame] | 11 | exit 0 |
| 12 | } |
| 13 | |
Denys Vlasenko | bfa1b2e | 2010-05-11 03:53:57 +0200 | [diff] [blame] | 14 | if test x"$CONFIG_MKFS_MINIX" != x"y" \ |
| 15 | || test x"$CONFIG_FEATURE_MINIX2" != x"y" \ |
Denys Vlasenko | c0211e9 | 2010-05-11 04:32:04 +0200 | [diff] [blame] | 16 | || test x"$CONFIG_FEATURE_MOUNT_LOOP" != x"y" \ |
Denys Vlasenko | da13824 | 2010-05-11 12:02:48 +0200 | [diff] [blame] | 17 | || test x"$CONFIG_FEATURE_MOUNT_FLAGS" != x"y" \ |
Denys Vlasenko | bfa1b2e | 2010-05-11 03:53:57 +0200 | [diff] [blame] | 18 | || test x"$CONFIG_FEATURE_DEVFS" = x"y" \ |
| 19 | ; then |
| 20 | echo "SKIPPED: mount" |
| 21 | exit 0 |
Chris Metcalf | 208d35d | 2010-04-02 09:57:27 +0200 | [diff] [blame] | 22 | fi |
| 23 | |
Denys Vlasenko | da13824 | 2010-05-11 12:02:48 +0200 | [diff] [blame] | 24 | testdir=$PWD/mount.testdir |
Denys Vlasenko | c1fc3d3 | 2009-07-18 17:22:03 +0200 | [diff] [blame] | 25 | |
Denys Vlasenko | 6ae6426 | 2009-07-18 16:22:26 +0200 | [diff] [blame] | 26 | dd if=/dev/zero of=mount.image1m count=1 bs=1M 2>/dev/null || { echo "dd error"; exit 1; } |
| 27 | 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] | 28 | modprobe minix 2>/dev/null |
| 29 | mkdir "$testdir" 2>/dev/null |
| 30 | umount -d "$testdir" 2>/dev/null |
Denis Vlasenko | 5d62462 | 2008-07-08 02:57:40 +0000 | [diff] [blame] | 31 | |
| 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 | |
| 36 | testing "mount -o remount,mand" \ |
Denis Vlasenko | abe49fa | 2008-07-11 21:41:14 +0000 | [diff] [blame] | 37 | "mount -o loop mount.image1m $testdir "\ |
Denis Vlasenko | 5d62462 | 2008-07-08 02:57:40 +0000 | [diff] [blame] | 38 | "&& 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 Vlasenko | c1fc3d3 | 2009-07-18 17:22:03 +0200 | [diff] [blame] | 44 | umount -d "$testdir" |
| 45 | rmdir "$testdir" |
Denis Vlasenko | abe49fa | 2008-07-11 21:41:14 +0000 | [diff] [blame] | 46 | rm mount.image1m |
Denis Vlasenko | 5d62462 | 2008-07-08 02:57:40 +0000 | [diff] [blame] | 47 | |
| 48 | exit $FAILCOUNT |