[tor-commits] [tor/master] test/parseconf: Standardise output messages

nickm at torproject.org nickm at torproject.org
Thu Nov 14 14:58:58 UTC 2019


commit 7ef44100c4d85fbd091c3965013b5465872a05f6
Author: teor <teor at torproject.org>
Date:   Tue Nov 12 15:21:10 2019 +1000

    test/parseconf: Standardise output messages
    
    Part of 32451.
---
 src/test/test_parseconf.sh | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/test/test_parseconf.sh b/src/test/test_parseconf.sh
index f298072c3..962d43dd7 100755
--- a/src/test/test_parseconf.sh
+++ b/src/test/test_parseconf.sh
@@ -311,20 +311,23 @@ for dir in "${EXAMPLEDIR}"/*; do
 
             if ! cmp "${DATA_DIR}/output.${testname}" \
                  "${DATA_DIR}/output_2.${testname}"; then
-                echo "FAIL: $EXPECTED did not match on round-trip." >&2
+                echo "FAIL: $EXPECTED did not match on round-trip:" >&2
+                diff -u "${DATA_DIR}/output.${testname}" \
+                     "${DATA_DIR}/output_2.${testname}" >&2 \
+                    || true
                 FINAL_EXIT=$EXITCODE
             fi
         else
             FAILED_CONFIG="yes"
-            echo "FAIL" >&2
             if test "$(wc -c < "${DATA_DIR}/output.${testname}")" = 0; then
+                echo "FAIL: $EXPECTED: Tor said:" >&2
                 # There was no output -- probably we failed.
                 "${TOR_BINARY}" -f "./torrc" \
                                 --defaults-torrc "${DEFAULTS}" \
                                 --verify-config \
                                 ${CMDLINE} || true
             fi
-            echo "FAIL: $EXPECTED did not match." >&2
+            echo "FAIL: $EXPECTED did not match:" >&2
             diff -u "$EXPECTED" "${DATA_DIR}/output.${testname}" >&2 \
                 || true
             FINAL_EXIT=$EXITCODE
@@ -346,8 +349,8 @@ for dir in "${EXAMPLEDIR}"/*; do
                 :
             else
                 FAILED_LOG="yes"
-                echo "FAIL" >&2
-                echo "Expected $EXPECTED_LOG: ${expect_log}" >&2
+                echo "FAIL: Expected $EXPECTED_LOG:" >&2
+                echo "${expect_log}" >&2
                 echo "Tor said:" >&2
                 cat "${DATA_DIR}/output_log.${testname}" >&2
                 FINAL_EXIT=$EXITCODE
@@ -378,8 +381,8 @@ for dir in "${EXAMPLEDIR}"/*; do
         if grep "${expect_err}" "${DATA_DIR}/output.${testname}" >/dev/null; then
             echo "OK"
         else
-            echo "FAIL" >&2
-            echo "Expected $ERROR: ${expect_err}" >&2
+            echo "FAIL: Expected $ERROR: " >&2
+            echo "${expect_err}" >&2
             echo "Tor said:" >&2
             cat "${DATA_DIR}/output.${testname}" >&2
             FINAL_EXIT=$EXITCODE





More information about the tor-commits mailing list