run-privoxy-tests.sh: Add -c option to continue in case of failures
authorFabian Keil <fk@fabiankeil.de>
Sun, 12 Jan 2025 14:14:20 +0000 (15:14 +0100)
committerFabian Keil <fk@fabiankeil.de>
Sun, 12 Jan 2025 15:52:17 +0000 (16:52 +0100)
tests/cts/run-privoxy-tests.sh

index 1b3e469..c45419b 100755 (executable)
@@ -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
 }