From c23a7f225984af1aa9fd0113f93be837a13d9b08 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Tue, 4 Jan 2022 15:24:52 +0100 Subject: 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 --- test.bash | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/test.bash b/test.bash index 6289072..f94f4d4 100755 --- a/test.bash +++ b/test.bash @@ -1,14 +1,23 @@ #!/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 export TMPDIR else echo "Using TMPDIR=$TMPDIR" fi -set -eu - cd "$(dirname "$0")" export GO111MODULE=on MYNAME=$(basename "$0") @@ -53,7 +62,7 @@ if ! go tool | grep vet > /dev/null ; then elif [[ -d vendor ]] ; then echo "vendor directory exists, skipping 'go tool vet'" else - go vet "$@" ./... + go vet ./... fi if command -v shellcheck > /dev/null ; then @@ -63,10 +72,18 @@ else echo "shellcheck not installed - skipping" fi -# We don't want all the subprocesses -# holding the lock file open -# vvvvv -go test -count 1 ./... "$@" 200>&- +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 +# holding the lock file open +# vvvvv +# shellcheck disable=SC2086 +go test -count 1 $EXTRA_ARGS ./... "$@" 200>&- # ^^^^^^^^ # Disable result caching -- cgit v1.2.3