mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Merge branch 'tor-github/pr/1195'
This commit is contained in:
+16
-3
@@ -167,9 +167,22 @@ EXTRA_DIST+= \
|
||||
README \
|
||||
ReleaseNotes \
|
||||
scripts/maint/checkIncludes.py \
|
||||
scripts/maint/checkSpace.pl \
|
||||
scripts/maint/practracker
|
||||
|
||||
scripts/maint/checkSpace.pl \
|
||||
scripts/maint/practracker/exceptions.txt \
|
||||
scripts/maint/practracker/metrics.py \
|
||||
scripts/maint/practracker/practracker.py \
|
||||
scripts/maint/practracker/practracker_tests.py \
|
||||
scripts/maint/practracker/problem.py \
|
||||
scripts/maint/practracker/testdata/a.c \
|
||||
scripts/maint/practracker/testdata/b.c \
|
||||
scripts/maint/practracker/testdata/ex0-expected.txt \
|
||||
scripts/maint/practracker/testdata/ex0.txt \
|
||||
scripts/maint/practracker/testdata/ex1-expected.txt \
|
||||
scripts/maint/practracker/testdata/ex1.txt \
|
||||
scripts/maint/practracker/testdata/ex.txt \
|
||||
scripts/maint/practracker/testdata/not_c_file \
|
||||
scripts/maint/practracker/test_practracker.sh \
|
||||
scripts/maint/practracker/util.py
|
||||
|
||||
## This tells etags how to find mockable function definitions.
|
||||
AM_ETAGSFLAGS=--regex='{c}/MOCK_IMPL([^,]+,\W*\([a-zA-Z0-9_]+\)\W*,/\1/s'
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
o Minor features (tests):
|
||||
- The practracker tests are now run as part of the Tor test suite.
|
||||
Closes ticket 31304.
|
||||
@@ -0,0 +1,3 @@
|
||||
o Minor bugfixes (distribution):
|
||||
- Do not ship any temporary files found in the scripts/maint/practracker
|
||||
directory. Fixes bug 31311; bugfix on 0.4.1.1-alpha.
|
||||
@@ -4,7 +4,12 @@
|
||||
|
||||
import unittest
|
||||
|
||||
import StringIO
|
||||
try:
|
||||
# python 2 names the module this way...
|
||||
from StringIO import StringIO
|
||||
except ImportError:
|
||||
# python 3 names the module this way.
|
||||
from io import StringIO
|
||||
|
||||
import metrics
|
||||
|
||||
@@ -38,7 +43,7 @@ fun,(
|
||||
|
||||
class TestFunctionLength(unittest.TestCase):
|
||||
def test_function_length(self):
|
||||
funcs = StringIO.StringIO(function_file)
|
||||
funcs = StringIO(function_file)
|
||||
# All functions should have length 2
|
||||
for name, lines in metrics.get_function_lines(funcs):
|
||||
self.assertEqual(name, "fun")
|
||||
@@ -50,7 +55,7 @@ class TestFunctionLength(unittest.TestCase):
|
||||
|
||||
class TestIncludeCount(unittest.TestCase):
|
||||
def test_include_count(self):
|
||||
f = StringIO.StringIO("""
|
||||
f = StringIO("""
|
||||
# include <abc.h>
|
||||
# include "def.h"
|
||||
#include "ghi.h"
|
||||
|
||||
@@ -28,23 +28,30 @@ run_practracker() {
|
||||
--max-include-count=0 --max-file-size=0 --max-function-size=0 --terse \
|
||||
"${DATA}/" "$@";
|
||||
}
|
||||
compare() {
|
||||
# we can't use cmp because we need to use -b for windows
|
||||
diff -b -u "$@" > "${TMPDIR}/test-diff"
|
||||
if test -z "$(cat "${TMPDIR}"/test-diff)"; then
|
||||
echo "OK"
|
||||
else
|
||||
cat "${TMPDIR}/test-diff"
|
||||
echo "FAILED"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
echo "unit tests:"
|
||||
|
||||
"${PYTHON:-python}" "${PRACTRACKER_DIR}/practracker_tests.py" || exit 1
|
||||
|
||||
echo "ex0:"
|
||||
|
||||
run_practracker --exceptions "${DATA}/ex0.txt" > "${TMPDIR}/ex0-received.txt"
|
||||
|
||||
if cmp "${TMPDIR}/ex0-received.txt" "${DATA}/ex0-expected.txt" ; then
|
||||
echo " OK"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
compare "${TMPDIR}/ex0-received.txt" "${DATA}/ex0-expected.txt"
|
||||
|
||||
echo "ex1:"
|
||||
|
||||
run_practracker --exceptions "${DATA}/ex1.txt" > "${TMPDIR}/ex1-received.txt"
|
||||
|
||||
if cmp "${TMPDIR}/ex1-received.txt" "${DATA}/ex1-expected.txt" ;then
|
||||
echo " OK"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
compare "${TMPDIR}/ex1-received.txt" "${DATA}/ex1-expected.txt"
|
||||
|
||||
+5
-1
@@ -31,7 +31,11 @@ TESTSCRIPTS += \
|
||||
endif
|
||||
|
||||
if USEPYTHON
|
||||
TESTSCRIPTS += src/test/test_ntor.sh src/test/test_hs_ntor.sh src/test/test_bt.sh
|
||||
TESTSCRIPTS += \
|
||||
src/test/test_ntor.sh \
|
||||
src/test/test_hs_ntor.sh \
|
||||
src/test/test_bt.sh \
|
||||
scripts/maint/practracker/test_practracker.sh
|
||||
|
||||
if COVERAGE_ENABLED
|
||||
# ...
|
||||
|
||||
Reference in New Issue
Block a user