mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-23 20:03:31 +01:00
Merge branch 'pr1599_squashed'
This commit is contained in:
commit
b7cfca1dee
@ -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"
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user