summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2019-08-24 15:37:29 +0100
committerSimon McVittie <smcv@debian.org>2020-03-09 16:38:24 +0000
commitbd2ff3a23bd293527087c4a12e22c839712df022 (patch)
tree30ab7bee750b719566f126f2452377f14a93f54f
parentab9a62b0f7e7786a92b2e7bc9eca1ad052f6c586 (diff)
downloadcogl-bd2ff3a23bd293527087c4a12e22c839712df022.tar.gz
tests: Show the actual output from tests if VERBOSE is set
Writing tests' output to a log file makes them difficult to debug when the test might be running on an autobuilder or CI system where only stdout/stderr are recorded. This is particularly troublesome if a failure is only reproducible on a particular autobuilder. Recent Automake versions have the convention that detailed output from failing tests is written to stdout/stderr, not just to log files, when the VERBOSE environment variable is set; borrow that convention as a trigger for producing detailed test output. Signed-off-by: Simon McVittie <smcv@debian.org>
-rwxr-xr-xtests/run-tests.sh9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/run-tests.sh b/tests/run-tests.sh
index 763e173b..3c02eb44 100755
--- a/tests/run-tests.sh
+++ b/tests/run-tests.sh
@@ -1,5 +1,7 @@
#!/bin/bash
+set -o pipefail
+
if test -z "$G_DEBUG"; then
G_DEBUG=fatal-warnings
else
@@ -64,7 +66,12 @@ get_status()
run_test()
{
- $($TEST_BINARY $1 &> "$LOG")
+ if [ -n "${VERBOSE-}" ]; then
+ echo "running $TEST_BINARY $1:"
+ $TEST_BINARY $1 2>&1 | tee "$LOG"
+ else
+ $($TEST_BINARY $1 &> "$LOG")
+ fi
TMP=$?
var_name=$2_result
eval $var_name=$TMP