[folks] Only spew D-Bus info during tests if >= 1



commit 4b9b2220056ca6e480a28fc3cb4e224d8fc98856
Author: Travis Reitter <travis reitter collabora co uk>
Date:   Mon Jan 17 12:03:16 2011 -0800

    Only spew D-Bus info during tests if  >= 1

 tests/tools/with-session-bus.sh |   25 +++++++++++++++++++++----
 1 files changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/tests/tools/with-session-bus.sh b/tests/tools/with-session-bus.sh
index 063bd7e..d98910b 100755
--- a/tests/tools/with-session-bus.sh
+++ b/tests/tools/with-session-bus.sh
@@ -13,6 +13,9 @@
 set -e
 
 me=with-session-bus
+if [ "x$V" = "x" ] ; then
+  V=0;
+fi
 
 dbus_daemon_args="--print-address=5 --print-pid=6 --fork"
 sleep=0
@@ -59,7 +62,10 @@ cleanup ()
 {
   pid=`head -n1 $me-$$.pid`
   if test -n "$pid" ; then
-    echo "Killing temporary bus daemon: $pid" >&2
+
+    if [ $V -gt 0 ] ; then
+      echo "Killing temporary bus daemon: $pid" >&2
+    fi
     kill -INT "$pid"
   fi
   rm -f $me-$$.address
@@ -69,15 +75,26 @@ cleanup ()
 trap cleanup INT HUP TERM
 dbus-daemon $dbus_daemon_args
 
-{ echo -n "Temporary bus daemon is "; cat $me-$$.address; } >&2
-{ echo -n "Temporary bus daemon PID is "; head -n1 $me-$$.pid; } >&2
+{
+  if [ $V -gt 0 ] ; then
+    echo -n "Temporary bus daemon is "; cat $me-$$.address;
+  fi
+} >&2
+{
+  if [ $V -gt 0 ] ; then
+    echo -n "Temporary bus daemon PID is "; head -n1 $me-$$.pid;
+  fi
+} >&2
 
 e=0
 DBUS_SESSION_BUS_ADDRESS="`cat $me-$$.address`"
 export DBUS_SESSION_BUS_ADDRESS
 
 if [ -n "$WITH_SESSION_BUS_FORK_DBUS_MONITOR" ] ; then
-  echo -n "Forking dbus-monitor $WITH_SESSION_BUS_FORK_DBUS_MONITOR_OPT" >&2
+  if [ $V -gt 0 ] ; then
+    echo -n "Forking dbus-monitor " \
+      "$WITH_SESSION_BUS_FORK_DBUS_MONITOR_OPT" >&2
+  fi
   dbus-monitor $WITH_SESSION_BUS_FORK_DBUS_MONITOR_OPT \
         > $me-$$.dbus-monitor-logs 2>&1 &
 fi



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