mount.tests 996 B

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/sh
  2. # Copyright 2007 by Denys Vlasenko <vda.linux@googlemail.com>
  3. # Licensed under GPL v2, see file LICENSE for details.
  4. . testing.sh
  5. test "`id -u`" = 0 || {
  6. echo "SKIPPED: must be root to test this"
  7. exit 0
  8. }
  9. testdir=$PWD/testdir
  10. dd if=/dev/zero of=mount.image1m count=1 bs=1M 2>/dev/null || { echo "dd error"; exit 1; }
  11. mkfs.minix -v mount.image1m >/dev/null 2>&1 || { echo "mkfs.minix error"; exit 1; }
  12. modprobe minix 2>/dev/null
  13. mkdir "$testdir" 2>/dev/null
  14. umount -d "$testdir" 2>/dev/null
  15. # testing "test name" "command" "expected result" "file input" "stdin"
  16. # file input will be file called "input"
  17. # test can create a file "actual" instead of writing to stdout
  18. testing "mount -o remount,mand" \
  19. "mount -o loop mount.image1m $testdir "\
  20. "&& grep -Fc $testdir </proc/mounts "\
  21. "&& mount -o remount,mand $testdir "\
  22. "&& grep -F $testdir </proc/mounts | grep -c '[, ]mand[, ]'" \
  23. "1\n""1\n" \
  24. "" ""
  25. umount -d "$testdir"
  26. rmdir "$testdir"
  27. rm mount.image1m
  28. exit $FAILCOUNT