summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorteor <teor@torproject.org>2019-12-12 16:15:29 +1000
committerteor <teor@torproject.org>2020-01-15 22:29:22 +1000
commitcda2ff196540f3b1fe8639e4e647285b58bb6752 (patch)
tree06d3d96e46ccb5936fa148db0c92394eddce6656 /scripts
parentf9a243a9d489142e36ddd0793dfa782228416f8f (diff)
downloadtor-cda2ff196540f3b1fe8639e4e647285b58bb6752.tar.gz
tor-cda2ff196540f3b1fe8639e4e647285b58bb6752.zip
practracker: Capture stderr output in test_practracker.sh
And canonicalise file paths, so that output is consistent, even in out-of-tree builds. Capturing stderr output produces better diagnostics. Diagnostics for 32705.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/maint/practracker/test_practracker.sh11
-rw-r--r--scripts/maint/practracker/testdata/ex0-expected.txt1
-rw-r--r--scripts/maint/practracker/testdata/ex1-expected.txt1
-rw-r--r--scripts/maint/practracker/testdata/ex1-overbroad-expected.txt1
4 files changed, 11 insertions, 3 deletions
diff --git a/scripts/maint/practracker/test_practracker.sh b/scripts/maint/practracker/test_practracker.sh
index 9b107e071d..3c87bc31be 100755
--- a/scripts/maint/practracker/test_practracker.sh
+++ b/scripts/maint/practracker/test_practracker.sh
@@ -15,6 +15,11 @@ if test "${PRACTRACKER_DIR}" = "" ||
PRACTRACKER_DIR=$(dirname "$0")
fi
+# Change to the tor directory, and canonicalise PRACTRACKER_DIR,
+# so paths in practracker output are consistent, even in out-of-tree builds
+cd "${PRACTRACKER_DIR}"/../../..
+PRACTRACKER_DIR="scripts/maint/practracker"
+
TMPDIR="$(mktemp -d -t pracktracker.test.XXXXXX)"
if test -z "${TMPDIR}" || test ! -d "${TMPDIR}" ; then
echo >&2 "mktemp failed."
@@ -52,18 +57,18 @@ echo "unit tests:"
echo "ex0:"
-run_practracker --exceptions "${DATA}/ex0.txt" > "${TMPDIR}/ex0-received.txt"
+run_practracker --exceptions "${DATA}/ex0.txt" > "${TMPDIR}/ex0-received.txt" 2>&1
compare "${TMPDIR}/ex0-received.txt" "${DATA}/ex0-expected.txt"
echo "ex1:"
-run_practracker --exceptions "${DATA}/ex1.txt" > "${TMPDIR}/ex1-received.txt"
+run_practracker --exceptions "${DATA}/ex1.txt" > "${TMPDIR}/ex1-received.txt" 2>&1
compare "${TMPDIR}/ex1-received.txt" "${DATA}/ex1-expected.txt"
echo "ex1.overbroad:"
-run_practracker --exceptions "${DATA}/ex1.txt" --list-overbroad > "${TMPDIR}/ex1-overbroad-received.txt"
+run_practracker --exceptions "${DATA}/ex1.txt" --list-overbroad > "${TMPDIR}/ex1-overbroad-received.txt" 2>&1
compare "${TMPDIR}/ex1-overbroad-received.txt" "${DATA}/ex1-overbroad-expected.txt"
diff --git a/scripts/maint/practracker/testdata/ex0-expected.txt b/scripts/maint/practracker/testdata/ex0-expected.txt
index 502005edb1..dc41c8700a 100644
--- a/scripts/maint/practracker/testdata/ex0-expected.txt
+++ b/scripts/maint/practracker/testdata/ex0-expected.txt
@@ -1,3 +1,4 @@
+Unusual pattern permitted.h in scripts/maint/practracker/testdata
problem file-size a.c 41
problem include-count a.c 6
problem function-size a.c:i_am_a_function() 9
diff --git a/scripts/maint/practracker/testdata/ex1-expected.txt b/scripts/maint/practracker/testdata/ex1-expected.txt
index 58140a4d9a..7800a2cd0e 100644
--- a/scripts/maint/practracker/testdata/ex1-expected.txt
+++ b/scripts/maint/practracker/testdata/ex1-expected.txt
@@ -1,3 +1,4 @@
+Unusual pattern permitted.h in scripts/maint/practracker/testdata
problem function-size a.c:i_am_a_function() 9
(warning) problem function-size a.c:another_function() 12
problem function-size b.c:foo() 4
diff --git a/scripts/maint/practracker/testdata/ex1-overbroad-expected.txt b/scripts/maint/practracker/testdata/ex1-overbroad-expected.txt
index b757202dae..ed3cbb29fe 100644
--- a/scripts/maint/practracker/testdata/ex1-overbroad-expected.txt
+++ b/scripts/maint/practracker/testdata/ex1-overbroad-expected.txt
@@ -1,2 +1,3 @@
+Unusual pattern permitted.h in scripts/maint/practracker/testdata
problem file-size a.c 45 -> 41
problem file-size z.c 100 -> 0