summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2019-08-24 15:37:29 +0100
committerSimon McVittie <smcv@debian.org>2020-05-27 15:50:21 +0100
commit2efd0dfc060b5c16db990de62649fc6b2d967bc9 (patch)
treef5cc712184598aaae7ad8cb90f6160a58f4eb30f
parent0b6a3166ed2758a8769f07dcc6f9a962cfd9ab5e (diff)
downloadmutter-wip/smcv/cogl-show-test-output.tar.gz
cogl tests: Show the actual output from tests if VERBOSE is setwip/smcv/cogl-show-test-output
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. This was originally cogl!14, but applies equally to mutter's fork of cogl. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1273 Signed-off-by: Simon McVittie <smcv@debian.org>
-rwxr-xr-xcogl/tests/run-tests.sh9
1 files changed, 8 insertions, 1 deletions
diff --git a/cogl/tests/run-tests.sh b/cogl/tests/run-tests.sh
index 825dd1251..ce7580fbe 100755
--- a/cogl/tests/run-tests.sh
+++ b/cogl/tests/run-tests.sh
@@ -1,5 +1,7 @@
#!/usr/bin/env bash
+set -o pipefail
+
if test -z "$G_DEBUG"; then
G_DEBUG=fatal-warnings
else
@@ -69,7 +71,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"