[folks/cleantestoutput] Make test output use color for PASS/FAIL. Don't show test output unless CHECK_VERBOSE is set. Fixes:



commit fc98984b1d70dcb3df480ce412817ac3e5de922d
Author: Jeremy Whiting <jpwhiting kde org>
Date:   Tue Jul 10 14:22:29 2012 -0600

    Make test output use color for PASS/FAIL.
    Don't show test output unless CHECK_VERBOSE is set.
    Fixes: bgo 657456

 configure.ac                    |    2 +-
 tests/tools/with-session-bus.sh |   17 +++++++++++++++--
 2 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 6730f12..fc98273 100644
--- a/configure.ac
+++ b/configure.ac
@@ -43,7 +43,7 @@ AC_CONFIG_SRCDIR([Makefile.am])
 AC_CONFIG_HEADERS(config.h)
 AC_CONFIG_SRCDIR([configure.ac])
 AM_INIT_AUTOMAKE([1.11 dist-xz no-define
-                  no-dist-gzip tar-ustar -Wno-portability])
+                  no-dist-gzip tar-ustar -Wno-portability color-tests])
 AM_MAINTAINER_MODE([enable])
 
 AC_PROG_CC
diff --git a/tests/tools/with-session-bus.sh b/tests/tools/with-session-bus.sh
index 83537c2..d807688 100755
--- a/tests/tools/with-session-bus.sh
+++ b/tests/tools/with-session-bus.sh
@@ -32,9 +32,22 @@ dbus_init 0
 dbus_start
 
 e=0
-"$@" || e=$?
+
+if test -t 1 && test "z$CHECK_VERBOSE" != z; then
+  "$@" || e=$?
+else
+  "$@" > capture-$$.log 2>&1 || e=$?
+fi
 
 trap - INT HUP TERM
 cleanup
 
-exit $e
+# if exit code is 0, check for skipped tests
+if test z$e = z0; then
+  grep -i skipped capture-$$.log || true
+  rm -f capture-$$.log
+# exit code is not 0, so output log and exit
+else
+  cat capture-$$.log
+  exit $e
+fi



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