run-with-tmp-session-bus.sh: create a unique temporary file per process

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 9d80d46a79)
This commit is contained in:
Simon McVittie 2013-09-05 13:05:21 +01:00
parent 3b4a09c04e
commit 42e12d342e
2 changed files with 7 additions and 4 deletions

View 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

View file

@ -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