From: Fabian Keil <fk@fabiankeil.de>
Date: Sun, 12 Jan 2025 14:14:20 +0000 (+0100)
Subject: run-privoxy-tests.sh: Add -c option to continue in case of failures
X-Git-Tag: v_4_0_0~18
X-Git-Url: http://www.privoxy.org/gitweb/@default-cgi@/static/user-manual/faq/@default-cgi@show-url-info?a=commitdiff_plain;h=0198f49d9a7dd8b95278cc44276338c313f26198;p=privoxy.git

run-privoxy-tests.sh: Add -c option to continue in case of failures
---

diff --git a/tests/cts/run-privoxy-tests.sh b/tests/cts/run-privoxy-tests.sh
index 1b3e469f..c45419bd 100755
--- a/tests/cts/run-privoxy-tests.sh
+++ b/tests/cts/run-privoxy-tests.sh
@@ -119,10 +119,17 @@ main() {
     local test_scenario=""
     local test_scenarios=""
     local start_privoxy=true
+    local ignore_errors=false
+    local scenarios_with_errors=""
 
     while [ -n "$1" ];
     do
         case "$1" in
+            "-c")
+                echo "Continuing in case of test failures."
+                ignore_errors=true
+                shift
+                ;;
             "-r")
                 echo "Not starting privoxy."
                 start_privoxy=false
@@ -146,12 +153,21 @@ main() {
 
     for test_scenario in ${test_scenarios}; do
         if [ "${test_scenario}" = "${UPSTREAM_TEST_SCENARIO}" ]; then
-            run_upstream_tests ${start_privoxy} || exit 1
+            run_upstream_tests ${start_privoxy}
         else
-            run_privoxy_tests ${start_privoxy} "${test_scenario}" || exit 1
+            run_privoxy_tests ${start_privoxy} "${test_scenario}"
+        fi
+        if [ $? != 0 ]; then
+            scenarios_with_errors="${scenarios_with_errors} ${test_scenario}"
+            ${ignore_errors} || exit 1
         fi
     done
 
+    if [ -n "${scenarios_with_errors}" ]; then
+       echo "The following test scenarios had at least one error:${scenarios_with_errors}"
+       exit 1
+    fi
+
     exit 0
 }