test.bash: disable parallelism in verbose mode

This way we get live output, and hopefully see clearer
where things hang if they do.

Also, don't pass on flags to "go vet", the verbose output
is pretty useless.

https://github.com/rfjakob/gocryptfs/issues/625
This commit is contained in:
Jakob Unterwurzacher 2022-01-04 15:24:52 +01:00
parent 700ae685cc
commit c23a7f2259

View File

@ -1,14 +1,23 @@
#!/bin/bash #!/bin/bash
if [[ -z $TMPDIR ]]; then set -eu
VERBOSE=0
for i in "$@" ; do
if [[ $i == "-v" ]] ; then
VERBOSE=1
set -x
break
fi
done
if [[ -z ${TMPDIR:-} ]]; then
TMPDIR=/var/tmp TMPDIR=/var/tmp
export TMPDIR export TMPDIR
else else
echo "Using TMPDIR=$TMPDIR" echo "Using TMPDIR=$TMPDIR"
fi fi
set -eu
cd "$(dirname "$0")" cd "$(dirname "$0")"
export GO111MODULE=on export GO111MODULE=on
MYNAME=$(basename "$0") MYNAME=$(basename "$0")
@ -53,7 +62,7 @@ if ! go tool | grep vet > /dev/null ; then
elif [[ -d vendor ]] ; then elif [[ -d vendor ]] ; then
echo "vendor directory exists, skipping 'go tool vet'" echo "vendor directory exists, skipping 'go tool vet'"
else else
go vet "$@" ./... go vet ./...
fi fi
if command -v shellcheck > /dev/null ; then if command -v shellcheck > /dev/null ; then
@ -63,10 +72,18 @@ else
echo "shellcheck not installed - skipping" echo "shellcheck not installed - skipping"
fi fi
EXTRA_ARGS=""
if [[ $VERBOSE -eq 1 ]]; then
# Disabling parallelism disables per-package output buffering, hence enabling
# live streaming of result output. And seeing where things hang.
EXTRA_ARGS="-p 1"
fi
# We don't want all the subprocesses # We don't want all the subprocesses
# holding the lock file open # holding the lock file open
# vvvvv # vvvvv
go test -count 1 ./... "$@" 200>&- # shellcheck disable=SC2086
go test -count 1 $EXTRA_ARGS ./... "$@" 200>&-
# ^^^^^^^^ # ^^^^^^^^
# Disable result caching # Disable result caching