mount.tests 909 B

1234567891011121314151617181920212223242526272829303132333435
  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. dd if=/dev/zero of=mount.image1m count=1 bs=1M 2>/dev/null || exit 1
  10. mkfs.minix -v mount.image1m >/dev/null 2>&1 || exit 1
  11. testdir=$PWD/testdir
  12. mkdir $testdir 2>/dev/null
  13. umount -d $testdir 2>/dev/null
  14. # testing "test name" "command" "expected result" "file input" "stdin"
  15. # file input will be file called "input"
  16. # test can create a file "actual" instead of writing to stdout
  17. testing "mount -o remount,mand" \
  18. "mount -o loop mount.image1m $testdir "\
  19. "&& grep -Fc $testdir </proc/mounts "\
  20. "&& mount -o remount,mand $testdir "\
  21. "&& grep -F $testdir </proc/mounts | grep -c '[, ]mand[, ]'" \
  22. "1\n""1\n" \
  23. "" ""
  24. umount -d $testdir
  25. rmdir $testdir
  26. rm mount.image1m
  27. exit $FAILCOUNT