diff options
author | teor <teor@torproject.org> | 2019-11-04 11:13:00 +1000 |
---|---|---|
committer | teor <teor@torproject.org> | 2019-11-05 11:08:36 +1000 |
commit | 98637a4782d7b4f631f60c0862094a77922ef4ef (patch) | |
tree | d7906997109c4a87ee4c92ab5ee73148f18a28be /src/test/test_parseconf.sh | |
parent | 5b04db59f69332ac6d44e12ad759e224a9cd3b99 (diff) | |
download | tor-98637a4782d7b4f631f60c0862094a77922ef4ef.tar.gz tor-98637a4782d7b4f631f60c0862094a77922ef4ef.zip |
test/parseconf: Send all errors to stderr
Obviously correct fixes on already reviewed code.
Diffstat (limited to 'src/test/test_parseconf.sh')
-rwxr-xr-x | src/test/test_parseconf.sh | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/src/test/test_parseconf.sh b/src/test/test_parseconf.sh index 50eeb497eb..234f16250c 100755 --- a/src/test/test_parseconf.sh +++ b/src/test/test_parseconf.sh @@ -163,9 +163,9 @@ for dir in "${EXAMPLEDIR}"/*; do # Check for broken configs if test -f "./error${suffix}"; then - echo "FAIL: Found both ${dir}/expected${suffix}" - echo "and ${dir}/error${suffix}." - echo "(Only one of these files should exist.)" + echo "FAIL: Found both ${dir}/expected${suffix}" >&2 + echo "and ${dir}/error${suffix}." >&2 + echo "(Only one of these files should exist.)" >&2 exit $EXITCODE fi @@ -200,13 +200,13 @@ for dir in "${EXAMPLEDIR}"/*; do if ! cmp "${DATA_DIR}/output.${testname}" \ "${DATA_DIR}/output_2.${testname}"; then - echo "Failure: did not match on round-trip." + echo "Failure: did not match on round-trip." >&2 exit $EXITCODE fi echo "OK" else - echo "FAIL" + echo "FAIL" >&2 if test "$(wc -c < "${DATA_DIR}/output.${testname}")" = 0; then # There was no output -- probably we failed. "${TOR_BINARY}" -f "./torrc" \ @@ -214,13 +214,21 @@ for dir in "${EXAMPLEDIR}"/*; do --verify-config \ ${CMDLINE} || true fi - diff -u "$EXPECTED" "${DATA_DIR}/output.${testname}" || /bin/true + echo "Failure: did not match." >&2 + diff -u "$EXPECTED" "${DATA_DIR}/output.${testname}" >&2 \ + || /bin/true exit $EXITCODE fi elif test -f "$ERROR"; then # This case should fail: run verify-config and see if it does. + if ! test -s "$ERROR"; then + echo "FAIL: error file '$ERROR' is empty." >&2 + echo "Empty error files match any output." >&2 + exit $EXITCODE + fi + "${TOR_BINARY}" --verify-config \ -f ./torrc \ --defaults-torrc "${DEFAULTS}" \ @@ -232,10 +240,10 @@ for dir in "${EXAMPLEDIR}"/*; do if grep "${expect_err}" "${DATA_DIR}/output.${testname}" >/dev/null; then echo "OK" else - echo "FAIL" - echo "Expected error: ${expect_err}" - echo "Tor said:" - cat "${DATA_DIR}/output.${testname}" + echo "FAIL" >&2 + echo "Expected error: ${expect_err}" >&2 + echo "Tor said:" >&2 + cat "${DATA_DIR}/output.${testname}" >&2 exit $EXITCODE fi @@ -243,7 +251,7 @@ for dir in "${EXAMPLEDIR}"/*; do # This case is not actually configured with a success or a failure. # call that an error. - echo "FAIL: Did not find ${dir}/*expected or ${dir}/*error." + echo "FAIL: Did not find ${dir}/*expected or ${dir}/*error." >&2 exit $EXITCODE fi |