cli-ignore-missing.sh 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/bash
  2. # Exit immediately if any command fails.
  3. # https://stackoverflow.com/a/2871034
  4. set -e -u -x
  5. # Normal
  6. ./xxhsum ./Makefile > ./.test.xxh
  7. ./xxhsum --check ./.test.xxh
  8. # Missing, expect error
  9. # (1) Create checksum file.
  10. # (2) Remove one of them.
  11. # (3) --check it
  12. # (4) Expect NG (missing file)
  13. cp Makefile .test.makefile
  14. ./xxhsum ./.test.makefile > ./.test.xxh
  15. rm ./.test.makefile
  16. ! ./xxhsum --check ./.test.xxh # Put '!' for expecting error
  17. # Missing, --ignore-missing
  18. # (1) Create checksum file.
  19. # (2) Remove one of them.
  20. # (3) --check it with --ignore-missing.
  21. # (4) Expect OK
  22. cp Makefile .test.makefile
  23. ./xxhsum Makefile ./.test.makefile > ./.test.xxh
  24. rm ./.test.makefile
  25. ./xxhsum --check --ignore-missing ./.test.xxh
  26. # Missing, --ignore-missing, expect error
  27. # (1) Create checksum file.
  28. # (2) Remove all of them.
  29. # (3) --check it with --ignore-missing.
  30. # (4) Expect NG (no file was verified).
  31. cp Makefile .test.makefile
  32. ./xxhsum ./.test.makefile > ./.test.xxh
  33. rm ./.test.makefile
  34. ! ./xxhsum --check --ignore-missing ./.test.xxh # Put '!' for expecting error
  35. # Cleanup
  36. ( rm ./.test.* ) || true
  37. echo OK