[tor-commits] [tor/master] test/parseconf: Always show the result file name on failure

teor at torproject.org teor at torproject.org
Tue Nov 5 04:28:52 UTC 2019


commit 233b96d83addba8d5db49e28f4d762cf34935afc
Author: teor <teor at torproject.org>
Date:   Mon Nov 4 12:28:39 2019 +1000

    test/parseconf: Always show the result file name on failure
    
    Obviously correct fixes on already reviewed code.
---
 changes/ticket32213_parseconf |  3 +++
 src/test/test_parseconf.sh    | 13 +++++++------
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/changes/ticket32213_parseconf b/changes/ticket32213_parseconf
new file mode 100644
index 000000000..a334bec5c
--- /dev/null
+++ b/changes/ticket32213_parseconf
@@ -0,0 +1,3 @@
+  o Testing:
+    - Improve the consistency of test_parseconf.sh output, and run all the
+      tests, even if one fails. Closes ticket 32213.
diff --git a/src/test/test_parseconf.sh b/src/test/test_parseconf.sh
index cd7cccb32..86a00f7a0 100755
--- a/src/test/test_parseconf.sh
+++ b/src/test/test_parseconf.sh
@@ -189,7 +189,7 @@ for dir in "${EXAMPLEDIR}"/*; do
                         --dump-config short \
                         ${CMDLINE} \
                         | "${FILTER}" > "${DATA_DIR}/output.${testname}" \
-                        || die "FAIL: Tor exited."
+                        || die "FAIL: $EXPECTED: Tor reported an error."
 
         if cmp "$EXPECTED" "${DATA_DIR}/output.${testname}">/dev/null ; then
             # Check round-trip.
@@ -198,11 +198,12 @@ for dir in "${EXAMPLEDIR}"/*; do
                             --dump-config short \
                             | "${FILTER}" \
                             > "${DATA_DIR}/output_2.${testname}" \
-                        || die "FAIL: Tor exited on round-trip."
+                        || die \
+                       "FAIL: $EXPECTED: Tor reported an error on round-trip."
 
             if ! cmp "${DATA_DIR}/output.${testname}" \
                  "${DATA_DIR}/output_2.${testname}"; then
-                echo "FAIL: did not match on round-trip." >&2
+                echo "FAIL: $EXPECTED did not match on round-trip." >&2
                 FINAL_EXIT=$EXITCODE
             fi
 
@@ -216,7 +217,7 @@ for dir in "${EXAMPLEDIR}"/*; do
                                 --verify-config \
                                 ${CMDLINE} || true
             fi
-            echo "FAIL: did not match." >&2
+            echo "FAIL: $EXPECTED did not match." >&2
             diff -u "$EXPECTED" "${DATA_DIR}/output.${testname}" >&2 \
                 || true
             FINAL_EXIT=$EXITCODE
@@ -236,14 +237,14 @@ for dir in "${EXAMPLEDIR}"/*; do
                         --defaults-torrc "${DEFAULTS}" \
                         ${CMDLINE} \
                         > "${DATA_DIR}/output.${testname}" \
-                        && die "FAIL: Tor did not report an error."
+                        && die "FAIL: $ERROR: Tor did not report an error."
 
         expect_err="$(cat $ERROR)"
         if grep "${expect_err}" "${DATA_DIR}/output.${testname}" >/dev/null; then
             echo "OK"
         else
             echo "FAIL" >&2
-            echo "Expected error: ${expect_err}" >&2
+            echo "Expected $ERROR: ${expect_err}" >&2
             echo "Tor said:" >&2
             cat "${DATA_DIR}/output.${testname}" >&2
             FINAL_EXIT=$EXITCODE





More information about the tor-commits mailing list