aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Unterwurzacher2022-01-04 15:24:52 +0100
committerJakob Unterwurzacher2022-01-04 15:25:26 +0100
commitc23a7f225984af1aa9fd0113f93be837a13d9b08 (patch)
treeeb72ff721d20ab252e50f6a641215a1458a7ab60
parent700ae685cc7cb99b396caeaeee4e39eeac20f1c7 (diff)
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
-rwxr-xr-xtest.bash33
1 files 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