mount.tests 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 -f "$bindir/.config" && . "$bindir/.config"
  6. test "`id -u`" = 0 || {
  7. echo "SKIPPED: mount (must be root to test this)"
  8. exit 0
  9. }
  10. if test x"$CONFIG_MKFS_MINIX" != x"y" \
  11. || test x"$CONFIG_FEATURE_MINIX2" != x"y" \
  12. || test x"$CONFIG_FEATURE_MOUNT_LOOP" != x"y" \
  13. || test x"$CONFIG_FEATURE_MOUNT_FLAGS" != x"y" \
  14. || test x"$CONFIG_FEATURE_DEVFS" = x"y" \
  15. ; then
  16. echo "SKIPPED: mount"
  17. exit 0
  18. fi
  19. testdir=$PWD/mount.testdir
  20. dd if=/dev/zero of=mount.image1m count=1 bs=1M 2>/dev/null || { echo "dd error"; exit 1; }
  21. mkfs.minix -v mount.image1m >/dev/null 2>&1 || { echo "mkfs.minix error"; exit 1; }
  22. modprobe minix 2>/dev/null
  23. mkdir "$testdir" 2>/dev/null
  24. umount -d "$testdir" 2>/dev/null
  25. # testing "test name" "command" "expected result" "file input" "stdin"
  26. # file input will be file called "input"
  27. # test can create a file "actual" instead of writing to stdout
  28. testing "mount -o remount,mand" \
  29. "mount -o loop mount.image1m $testdir "\
  30. "&& grep -Fc $testdir </proc/mounts "\
  31. "&& mount -o remount,mand $testdir "\
  32. "&& grep -F $testdir </proc/mounts | grep -c '[, ]mand[, ]'" \
  33. "1\n""1\n" \
  34. "" ""
  35. umount -d "$testdir"
  36. rmdir "$testdir"
  37. rm mount.image1m
  38. exit $FAILCOUNT