Make test output use color for PASS/FAIL.
authorJeremy Whiting <jpwhiting@kde.org>
Tue, 10 Jul 2012 20:22:29 +0000 (14:22 -0600)
committerJeremy Whiting <jpwhiting@kde.org>
Tue, 10 Jul 2012 20:22:29 +0000 (14:22 -0600)
Don't show test output unless CHECK_VERBOSE is set.
Fixes: bgo 657456

configure.ac
tests/tools/with-session-bus.sh

index 6730f12..fc98273 100644 (file)
@@ -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
index 83537c2..d807688 100755 (executable)
@@ -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