aboutsummaryrefslogtreecommitdiff
path: root/scripts/maint/checkSpaceTest.sh
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-11-26 13:10:39 -0500
committerteor <teor@torproject.org>2019-12-03 12:56:46 +1000
commitbd61a4e84891027dfabba6be62886f3baeb41e27 (patch)
tree0570d8f48526274bb3f3d252285ce138499e87ce /scripts/maint/checkSpaceTest.sh
parent2aaa7ae6e2559d4fa62efc57b1cf2660868d9323 (diff)
downloadtor-bd61a4e84891027dfabba6be62886f3baeb41e27.tar.gz
tor-bd61a4e84891027dfabba6be62886f3baeb41e27.zip
Add a simple test for checkSpace.pl
This script is not expected to work on windows due to line-ending issues, so I'm not making it get run on an automated basis. We should use it when editing checkSpace.pl. Closes ticket 32613.
Diffstat (limited to 'scripts/maint/checkSpaceTest.sh')
-rwxr-xr-xscripts/maint/checkSpaceTest.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/scripts/maint/checkSpaceTest.sh b/scripts/maint/checkSpaceTest.sh
new file mode 100755
index 0000000000..a1eea58ebc
--- /dev/null
+++ b/scripts/maint/checkSpaceTest.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+# Copyright 2019, The Tor Project, Inc.
+# See LICENSE for licensing information
+
+# Integration test for checkSpace.pl, which we want to rewrite.
+
+umask 077
+set -e
+
+# make a safe space for temporary files
+DATA_DIR=$(mktemp -d -t tor_checkspace_tests.XXXXXX)
+trap 'rm -rf "$DATA_DIR"' 0
+
+RECEIVED_FNAME="${DATA_DIR}/got.txt"
+
+cd "$(dirname "$0")/checkspace_tests"
+
+# we expect this to give an error code.
+../checkSpace.pl -C ./*.[ch] ./*/*.[ch] > "${RECEIVED_FNAME}" && exit 1
+
+diff -u expected.txt "${RECEIVED_FNAME}" || exit 1
+
+echo "OK"