[Privoxy-commits] [privoxy] 21/38: run-privoxy-tests.sh: Add valgrind support that can be enabled with "-v"

User Git git at git.privoxy.org
Thu Apr 9 09:37:19 CEST 2026


This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository privoxy.

commit 056ef39de10e61dd07c5c79bdf9bb2bd1e36156d
Author: Fabian Keil <fk at fabiankeil.de>
AuthorDate: Wed Apr 1 15:58:51 2026 +0200

    run-privoxy-tests.sh: Add valgrind support that can be enabled with "-v"
---
 tests/cts/run-privoxy-tests.sh | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/tests/cts/run-privoxy-tests.sh b/tests/cts/run-privoxy-tests.sh
index cd502969..3452c2b1 100755
--- a/tests/cts/run-privoxy-tests.sh
+++ b/tests/cts/run-privoxy-tests.sh
@@ -27,9 +27,11 @@ UPSTREAM_TEST_SCENARIO=upstream-tests
 # elegant method to verify that Privoxy is running or failed to start.
 SECONDS_TO_WAIT_FOR_PRIVOXY_TO_START=1
 
+USE_VALGRIND=false
+
 start_privoxy() {
     local test_dir test_scenario
-    local privoxy_config privoxy_binary pid_file log_file
+    local privoxy_config privoxy_binary pid_file log_file valgrind_command valgrind_log_file
     test_dir="${1}"
     test_scenario="${2}"
 
@@ -38,9 +40,16 @@ start_privoxy() {
     pid_file="${test_dir}/${test_scenario}/../privoxy.pid"
     log_file="${test_dir}/logs/${test_scenario}.log"
 
-    (
+    if $USE_VALGRIND; then
+        valgrind_log_file="${test_dir}/logs/${test_scenario}-valgrind.log"
+        valgrind_command="valgrind --tool=memcheck --leak-check=full --log-file=$valgrind_log_file
+           --trace-children=yes --track-origins=yes"
+        SECONDS_TO_WAIT_FOR_PRIVOXY_TO_START=3
+    fi
+
+     (
         cd "${privoxy_config_dir}" || exit 1
-        "${privoxy_binary}" --no-daemon \
+        $valgrind_command "${privoxy_binary}" --no-daemon \
                             --pidfile "${pid_file}" \
                             privoxy.conf > "${log_file}" 2>&1 || exit 1 &
     )
@@ -140,6 +149,11 @@ main() {
                 test_scenarios="$1"
                 shift
                 ;;
+            "-v")
+                echo "Running Privoxy through valgrind."
+                USE_VALGRIND=true
+                shift
+                ;;
             "--")
                 shift
                 echo "Passing remaining arguments to runtests-wrapper.sh: ${@}"

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Privoxy-commits mailing list