test/parseconf: Standardise output messages

Part of 32451.
This commit is contained in:
teor 2019-11-12 15:21:10 +10:00
parent 3df6432006
commit 7ef44100c4

View File

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