mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-09-21 13:34:59 +02:00
test/parseconf: Stop adding newlines to *_printf
Cleanup after 32451.
This commit is contained in:
parent
2c4ada729e
commit
51a6c0c8fd
@ -167,7 +167,6 @@ fail_printf()
|
|||||||
# The first argument is a printf string, so this warning is spurious
|
# The first argument is a printf string, so this warning is spurious
|
||||||
# shellcheck disable=SC2059
|
# shellcheck disable=SC2059
|
||||||
printf "$@" >&2
|
printf "$@" >&2
|
||||||
printf "\\n" >&2
|
|
||||||
NEXT_TEST="yes"
|
NEXT_TEST="yes"
|
||||||
FINAL_EXIT=$EXITCODE
|
FINAL_EXIT=$EXITCODE
|
||||||
}
|
}
|
||||||
@ -180,7 +179,6 @@ die_printf()
|
|||||||
# The first argument is a printf string, so this warning is spurious
|
# The first argument is a printf string, so this warning is spurious
|
||||||
# shellcheck disable=SC2059
|
# shellcheck disable=SC2059
|
||||||
printf "$@" >&2
|
printf "$@" >&2
|
||||||
printf "\\n" >&2
|
|
||||||
exit $EXITCODE
|
exit $EXITCODE
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,11 +189,11 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
EMPTY="${DATA_DIR}/EMPTY"
|
EMPTY="${DATA_DIR}/EMPTY"
|
||||||
touch "$EMPTY" || die_printf "Couldn't create empty file '%s'." \
|
touch "$EMPTY" || die_printf "Couldn't create empty file '%s'.\\n" \
|
||||||
"$EMPTY"
|
"$EMPTY"
|
||||||
NON_EMPTY="${DATA_DIR}/NON_EMPTY"
|
NON_EMPTY="${DATA_DIR}/NON_EMPTY"
|
||||||
echo "This pattern should not match any log messages" \
|
echo "This pattern should not match any log messages" \
|
||||||
> "$NON_EMPTY" || die_printf "Couldn't create non-empty file '%s'." \
|
> "$NON_EMPTY" || die_printf "Couldn't create non-empty file '%s'.\\n" \
|
||||||
"$NON_EMPTY"
|
"$NON_EMPTY"
|
||||||
|
|
||||||
STANDARD_LIBS="libevent\\|openssl\\|zlib"
|
STANDARD_LIBS="libevent\\|openssl\\|zlib"
|
||||||
@ -216,7 +214,7 @@ TOR_LIBS_ENABLED=${TOR_LIBS_ENABLED%_}
|
|||||||
TOR_LIBS_ENABLED_COUNT="$(echo "$TOR_LIBS_ENABLED_SEARCH" \
|
TOR_LIBS_ENABLED_COUNT="$(echo "$TOR_LIBS_ENABLED_SEARCH" \
|
||||||
| tr ' ' '\n' | wc -l)"
|
| tr ' ' '\n' | wc -l)"
|
||||||
if test "$TOR_LIBS_ENABLED_COUNT" -gt 3; then
|
if test "$TOR_LIBS_ENABLED_COUNT" -gt 3; then
|
||||||
die_printf "Can not handle more than 3 optional libraries"
|
die_printf "Can not handle more than 3 optional libraries.\\n"
|
||||||
fi
|
fi
|
||||||
# Brute-force the combinations of libraries
|
# Brute-force the combinations of libraries
|
||||||
TOR_LIBS_ENABLED_SEARCH_3="$(echo "$TOR_LIBS_ENABLED" \
|
TOR_LIBS_ENABLED_SEARCH_3="$(echo "$TOR_LIBS_ENABLED" \
|
||||||
@ -301,7 +299,7 @@ dump_config()
|
|||||||
--defaults-torrc "$2" \
|
--defaults-torrc "$2" \
|
||||||
$3 \
|
$3 \
|
||||||
> "$4"; then
|
> "$4"; then
|
||||||
fail_printf "'%s': Tor --dump-config reported an error%s:\\n%s" \
|
fail_printf "'%s': Tor --dump-config reported an error%s:\\n%s\\n" \
|
||||||
"$5" \
|
"$5" \
|
||||||
"$CONTEXT" \
|
"$CONTEXT" \
|
||||||
"$FULL_TOR_CMD"
|
"$FULL_TOR_CMD"
|
||||||
@ -325,7 +323,7 @@ filter()
|
|||||||
|
|
||||||
"$FILTER" "$1" \
|
"$FILTER" "$1" \
|
||||||
> "$2" \
|
> "$2" \
|
||||||
|| fail_printf "'%s': Filter '%s' reported an error%s." \
|
|| fail_printf "'%s': Filter '%s' reported an error%s.\\n" \
|
||||||
"$3" \
|
"$3" \
|
||||||
"$FILTER" \
|
"$FILTER" \
|
||||||
"$CONTEXT"
|
"$CONTEXT"
|
||||||
@ -352,7 +350,7 @@ check_diff()
|
|||||||
if cmp "$1" "$2" > /dev/null; then
|
if cmp "$1" "$2" > /dev/null; then
|
||||||
return "$TRUE"
|
return "$TRUE"
|
||||||
else
|
else
|
||||||
fail_printf "'%s': Tor --dump-config said%s:\\n%s" \
|
fail_printf "'%s': Tor --dump-config said%s:\\n%s\\n" \
|
||||||
"$1" \
|
"$1" \
|
||||||
"$CONTEXT" \
|
"$CONTEXT" \
|
||||||
"$7"
|
"$7"
|
||||||
@ -417,7 +415,7 @@ check_dump_config()
|
|||||||
check_empty_pattern()
|
check_empty_pattern()
|
||||||
{
|
{
|
||||||
if ! test -s "$1"; then
|
if ! test -s "$1"; then
|
||||||
fail_printf "%s file '%s' is empty, and will match any output." \
|
fail_printf "%s file '%s' is empty, and will match any output.\\n" \
|
||||||
"$2" \
|
"$2" \
|
||||||
"$1"
|
"$1"
|
||||||
return "$TRUE"
|
return "$TRUE"
|
||||||
@ -455,7 +453,7 @@ verify_config()
|
|||||||
|
|
||||||
# Convert the actual and expected results to boolean, and compare
|
# Convert the actual and expected results to boolean, and compare
|
||||||
if test $((! (! RESULT))) -ne $((! (! $5))); then
|
if test $((! (! RESULT))) -ne $((! (! $5))); then
|
||||||
fail_printf "'%s': Tor --verify-config did not %s:\\n%s" \
|
fail_printf "'%s': Tor --verify-config did not %s:\\n%s\\n" \
|
||||||
"$6" \
|
"$6" \
|
||||||
"$7" \
|
"$7" \
|
||||||
"$FULL_TOR_CMD"
|
"$FULL_TOR_CMD"
|
||||||
@ -476,7 +474,7 @@ check_pattern()
|
|||||||
{
|
{
|
||||||
expect_log="$(cat "$1")"
|
expect_log="$(cat "$1")"
|
||||||
if ! grep "$expect_log" "$2" > /dev/null; then
|
if ! grep "$expect_log" "$2" > /dev/null; then
|
||||||
fail_printf "Expected %s '%s':\\n%s" \
|
fail_printf "Expected %s '%s':\\n%s\\n" \
|
||||||
"$3" \
|
"$3" \
|
||||||
"$1" \
|
"$1" \
|
||||||
"$expect_log"
|
"$expect_log"
|
||||||
@ -566,7 +564,7 @@ for dir in "${EXAMPLEDIR}"/*; do
|
|||||||
|
|
||||||
# Check for broken configs
|
# Check for broken configs
|
||||||
if test -f "./error${suffix}"; then
|
if test -f "./error${suffix}"; then
|
||||||
fail_printf "Found both '%s' and '%s'.%s" \
|
fail_printf "Found both '%s' and '%s'.%s\\n" \
|
||||||
"${dir}/expected${suffix}" \
|
"${dir}/expected${suffix}" \
|
||||||
"${dir}/error${suffix}" \
|
"${dir}/error${suffix}" \
|
||||||
"(Only one of these files should exist.)"
|
"(Only one of these files should exist.)"
|
||||||
@ -637,7 +635,7 @@ for dir in "${EXAMPLEDIR}"/*; do
|
|||||||
else
|
else
|
||||||
# This case is not actually configured with a success or a failure.
|
# This case is not actually configured with a success or a failure.
|
||||||
# call that an error.
|
# call that an error.
|
||||||
fail_printf "Did not find ${dir}/*expected or ${dir}/*error."
|
fail_printf "Did not find ${dir}/*expected or ${dir}/*error.\\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -z "$NEXT_TEST"; then
|
if test -z "$NEXT_TEST"; then
|
||||||
|
Loading…
Reference in New Issue
Block a user