Skip to content
Snippets Groups Projects
Unverified Commit b7cfca1d authored by teor's avatar teor
Browse files

Merge branch 'pr1599_squashed'

parents c80694de b910ae8c
No related branches found
No related tags found
No related merge requests found
#!/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"
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
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
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment