Correct syntax & formatting in test_pratracker.sh

Use 4 spaces for indentations.
Use the same syntax for all functions.
No real code changes (except removal of unnecessary ";" from
"exit 1" command).
This commit is contained in:
skaluzka 2021-08-22 20:36:36 +02:00
parent 984e3a9c6c
commit bbbeed942f
No known key found for this signature in database
GPG Key ID: BA6384EF5EF76DF2

View File

@ -1,15 +1,15 @@
#!/bin/sh #!/bin/sh
# Fail if any subprocess fails unexpectedly # Fail this script if any subprocess fails unexpectedly.
set -e set -e
umask 077 umask 077
unset TOR_DISABLE_PRACTRACKER unset TOR_DISABLE_PRACTRACKER
TMPDIR="" TMPDIR=""
clean () { clean() {
if [ -n "$TMPDIR" ] && [ -d "$TMPDIR" ]; then if [ -n "$TMPDIR" ] && [ -d "$TMPDIR" ]; then
rm -rf "$TMPDIR" rm -rf "$TMPDIR"
fi fi
} }
trap clean EXIT HUP INT TERM trap clean EXIT HUP INT TERM
@ -27,7 +27,7 @@ PRACTRACKER_DIR="scripts/maint/practracker"
TMPDIR="$(mktemp -d -t pracktracker.test.XXXXXX)" TMPDIR="$(mktemp -d -t pracktracker.test.XXXXXX)"
if test -z "${TMPDIR}" || test ! -d "${TMPDIR}" ; then if test -z "${TMPDIR}" || test ! -d "${TMPDIR}" ; then
echo >&2 "mktemp failed." echo >&2 "mktemp failed."
exit 1; exit 1
fi fi
DATA="${PRACTRACKER_DIR}/testdata" DATA="${PRACTRACKER_DIR}/testdata"
@ -43,6 +43,7 @@ run_practracker() {
--terse \ --terse \
"${DATA}/" "$@" || echo "practracker exit status: $?" "${DATA}/" "$@" || echo "practracker exit status: $?"
} }
compare() { compare() {
# we can't use cmp because we need to use -b for windows # we can't use cmp because we need to use -b for windows
diff -b -u "$@" > "${TMPDIR}/test-diff" || true diff -b -u "$@" > "${TMPDIR}/test-diff" || true