mount.tests 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. # Bug: mount.shared1 directory shows no files (has to show files a and b)
  39. optional FEATURE_LS_RECURSIVE
  40. testing "mount bind+rshared" "\
  41. mkdir -p mount.dir mount.shared1 mount.shared2
  42. touch mount.dir/a mount.dir/b
  43. mount --bind mount.shared1 mount.shared1 2>&1
  44. mount --make-rshared mount.shared1 2>&1
  45. mount --bind mount.shared2 mount.shared2 2>&1
  46. mount --make-rshared mount.shared2 2>&1
  47. mount --bind mount.shared2 mount.shared1 2>&1
  48. mount --bind mount.dir mount.shared2 2>&1
  49. ls -R mount.dir mount.shared1 mount.shared2 2>&1
  50. umount mount.dir mount.shared1 mount.shared2 2>/dev/null
  51. umount mount.dir mount.shared1 mount.shared2 2>/dev/null
  52. umount mount.dir mount.shared1 mount.shared2 2>/dev/null
  53. rm -f mount.dir/a mount.dir/b mount.dir/c
  54. rmdir mount.dir mount.shared1 mount.shared2
  55. " \
  56. "\
  57. mount.dir:
  58. a
  59. b
  60. mount.shared1:
  61. a
  62. b
  63. mount.shared2:
  64. a
  65. b
  66. " \
  67. "" ""
  68. SKIP=
  69. exit $FAILCOUNT