run-with-tmp-session-bus.sh: create a unique temporary file per process
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Thu, 5 Sep 2013 12:05:21 +0000 (13:05 +0100)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Thu, 5 Sep 2013 12:05:21 +0000 (13:05 +0100)
This makes the regression tests OK to run in parallel.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68852
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
(cherry picked from commit 9d80d46a794e0770494aa517d1b94e7e6ea9e21d)

test/name-test/.gitignore
tools/run-with-tmp-session-bus.sh

index 09f7ad3..2bf313a 100644 (file)
@@ -3,7 +3,7 @@
 Makefile
 Makefile.in
 echo-error-output.tmp
-run-with-tmp-session-bus.conf
+tmp-session-bus.*.conf
 test-ids
 test-names
 test-pending-call-dispatch
index c39999f..3f5a8fa 100755 (executable)
@@ -4,13 +4,16 @@ SCRIPTNAME=$0
 WRAPPED_SCRIPT=$1
 shift
 
-die() 
+CONFIG_FILE=./tmp-session-bus.$$.conf
+
+die ()
 {
     if ! test -z "$DBUS_SESSION_BUS_PID" ; then
         echo "killing message bus "$DBUS_SESSION_BUS_PID >&2
         kill -9 $DBUS_SESSION_BUS_PID
     fi
-    echo $SCRIPTNAME: $* >&2
+    echo "$SCRIPTNAME: $*" >&2
+    rm -f "$CONFIG_FILE"
     exit 1
 }
 
@@ -21,7 +24,6 @@ fi
 ## convenient to be able to ctrl+C without leaking the message bus process
 trap 'die "Received SIGINT"' INT
 
-CONFIG_FILE=./run-with-tmp-session-bus.conf
 SERVICE_DIR="$DBUS_TOP_BUILDDIR/test/data/valid-service-files"
 ESCAPED_SERVICE_DIR=`echo $SERVICE_DIR | sed -e 's/\//\\\\\\//g'`
 echo "escaped service dir is: $ESCAPED_SERVICE_DIR" >&2
@@ -73,4 +75,5 @@ sleep 2
 ## be sure it really died 
 kill -9 $DBUS_SESSION_BUS_PID > /dev/null 2>&1 || true
 
+rm -f "$CONFIG_FILE"
 exit 0