]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Makefile/git scripts: Add the practracker unit tests
authorteor <teor@torproject.org>
Sat, 16 Nov 2019 11:44:44 +0000 (21:44 +1000)
committerNick Mathewson <nickm@torproject.org>
Wed, 4 Dec 2019 17:15:22 +0000 (12:15 -0500)
Add a check-practracker-unit-test target, and run it as part of
"make check".

Add the practracker unit tests to scripts/git/pre-commit.git-hook.

Part of 32609.

Makefile.am
changes/ticket32609 [new file with mode: 0644]
scripts/git/pre-commit.git-hook

index 38040a4e75afb980e662f25719c883c9caf6253d..0c3a4fb76d6e1d220c107815d49c397626e22d5f 100644 (file)
@@ -253,7 +253,10 @@ test: all
 shellcheck:
        $(top_srcdir)/scripts/maint/checkShellScripts.sh
 
-check-local: check-spaces check-changes check-includes check-best-practices shellcheck check-cocci
+check-practracker-unit-test:
+       $(top_srcdir)/scripts/maint/practracker/test_practracker.sh
+
+check-local: check-spaces check-changes check-includes check-practracker-unit-test check-best-practices shellcheck check-cocci
 
 need-chutney-path:
        @if test ! -d "$$CHUTNEY_PATH"; then \
diff --git a/changes/ticket32609 b/changes/ticket32609
new file mode 100644 (file)
index 0000000..2fc3f73
--- /dev/null
@@ -0,0 +1,3 @@
+  o Testing:
+    - Run the practracker unit tests as part of "make check", and in the
+      pre-commit git hook. Closes ticket 32609.
index c138d2ae214c173e4d0d5bec3ab5edf63b05271e..c5adfaffe7bd60081292adb9cf8687741733c099 100755 (executable)
@@ -54,6 +54,13 @@ if [ -e scripts/maint/checkShellScripts.sh ]; then
     scripts/maint/checkShellScripts.sh
 fi
 
+# Always run the practracker unit tests
+PT_DIR=scripts/maint/practracker
+
+if [ -e "${PT_DIR}/test_practracker.sh" ]; then
+    "${PT_DIR}/test_practracker.sh"
+fi
+
 if [ ! "$CHECK_FILES" ]; then
     echo "No modified tor-owned source files, skipping further checks"
     exit 0
@@ -75,13 +82,9 @@ fi
 # Only call practracker if ${PT_DIR}/.enable_practracker_in_hooks exists
 # We do this check so that we can enable practracker in hooks in master, and
 # disable it on maint branches
-PT_DIR=scripts/maint/practracker
-
 if [ -e "${PT_DIR}/practracker.py" ]; then
     if [ -e "${PT_DIR}/.enable_practracker_in_hooks" ]; then
-        if ! python3 "${PT_DIR}/practracker.py" "$workdir"; then
-            exit 1
-        fi
+        python3 "${PT_DIR}/practracker.py" "$workdir"
     fi
 fi