[cogl/wip/smcv/tests-verbose] tests: Show the actual output from tests if VERBOSE is set



commit 319073c3ecfd265fc277fe6fee441287bc098314
Author: Simon McVittie <smcv debian org>
Date:   Sat Aug 24 15:37:29 2019 +0100

    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.
    
    Signed-off-by: Simon McVittie <smcv debian org>

 tests/run-tests.sh | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
---
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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]