checkSpaceTest.sh 872 B

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/sh
  2. # Copyright 2019, The Tor Project, Inc.
  3. # See LICENSE for licensing information
  4. # Integration test for checkSpace.pl, which we want to rewrite.
  5. umask 077
  6. set -e
  7. # Skip this test if we're running on Windows; we expect line-ending
  8. # issues in that case.
  9. case "$(uname -s)" in
  10. CYGWIN*) WINDOWS=1;;
  11. MINGW*) WINDOWS=1;;
  12. MSYS*) WINDOWS=1;;
  13. *) WINDOWS=0;;
  14. esac
  15. if test "$WINDOWS" = 1; then
  16. # This magic value tells automake that the test has been skipped.
  17. exit 77
  18. fi
  19. # make a safe space for temporary files
  20. DATA_DIR=$(mktemp -d -t tor_checkspace_tests.XXXXXX)
  21. trap 'rm -rf "$DATA_DIR"' 0
  22. RECEIVED_FNAME="${DATA_DIR}/got.txt"
  23. cd "$(dirname "$0")/checkspace_tests"
  24. # we expect this to give an error code.
  25. ../checkSpace.pl -C ./*.[ch] ./*/*.[ch] > "${RECEIVED_FNAME}" && exit 1
  26. diff -u expected.txt "${RECEIVED_FNAME}" || exit 1
  27. echo "OK"