diff options
author | teor <teor@torproject.org> | 2020-01-15 22:31:01 +1000 |
---|---|---|
committer | teor <teor@torproject.org> | 2020-01-15 22:31:01 +1000 |
commit | b7cfca1dee4d4435f87c2e7b7233f51a956c56ee (patch) | |
tree | 3a4e34f0d53e891aee652f62be7bf7d4a558e075 /scripts/maint | |
parent | c80694deccb6f7d00cf97415a75f0c85fabd9131 (diff) | |
parent | b910ae8cd18973d8cd846583599cf62a723b58fa (diff) | |
download | tor-b7cfca1dee4d4435f87c2e7b7233f51a956c56ee.tar.gz tor-b7cfca1dee4d4435f87c2e7b7233f51a956c56ee.zip |
Merge branch 'pr1599_squashed'
Diffstat (limited to 'scripts/maint')
4 files changed, 29 insertions, 9 deletions
diff --git a/scripts/maint/practracker/test_practracker.sh b/scripts/maint/practracker/test_practracker.sh index 207a5ceded..afc267a000 100755 --- a/scripts/maint/practracker/test_practracker.sh +++ b/scripts/maint/practracker/test_practracker.sh @@ -1,5 +1,8 @@ #!/bin/sh +# Fail if any subprocess fails unexpectedly +set -e + umask 077 unset TOR_DISABLE_PRACTRACKER @@ -16,6 +19,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." @@ -33,11 +41,11 @@ run_practracker() { --max-h-include-count=0 \ --max-include-count=0 \ --terse \ - "${DATA}/" "$@"; + "${DATA}/" "$@" || echo "practracker exit status: $?" } compare() { # we can't use cmp because we need to use -b for windows - diff -b -u "$@" > "${TMPDIR}/test-diff" + diff -b -u "$@" > "${TMPDIR}/test-diff" || true if test -z "$(cat "${TMPDIR}"/test-diff)"; then echo "OK" else @@ -49,22 +57,28 @@ compare() { echo "unit tests:" -"${PYTHON:-python}" "${PRACTRACKER_DIR}/practracker_tests.py" || exit 1 +"${PYTHON:-python}" "${PRACTRACKER_DIR}/practracker_tests.py" 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" +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" +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" +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..c9fb83bac3 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 @@ -9,3 +10,4 @@ problem function-size b.c:bar() 5 problem file-size header.h 8 problem include-count header.h 4 problem dependency-violation header.h 3 +practracker exit status: 11 diff --git a/scripts/maint/practracker/testdata/ex1-expected.txt b/scripts/maint/practracker/testdata/ex1-expected.txt index 58140a4d9a..2713338ae4 100644 --- a/scripts/maint/practracker/testdata/ex1-expected.txt +++ b/scripts/maint/practracker/testdata/ex1-expected.txt @@ -1,3 +1,5 @@ +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 +practracker exit status: 2 diff --git a/scripts/maint/practracker/testdata/ex1-overbroad-expected.txt b/scripts/maint/practracker/testdata/ex1-overbroad-expected.txt index b757202dae..5ca480dc04 100644 --- a/scripts/maint/practracker/testdata/ex1-overbroad-expected.txt +++ b/scripts/maint/practracker/testdata/ex1-overbroad-expected.txt @@ -1,2 +1,4 @@ +Unusual pattern permitted.h in scripts/maint/practracker/testdata problem file-size a.c 45 -> 41 problem file-size z.c 100 -> 0 +practracker exit status: 3 |