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