mount.tests 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/sh
  2. # Copyright 2007 by Denys Vlasenko <vda.linux@googlemail.com>
  3. # Licensed under GPLv2, see file LICENSE in this source tree.
  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