summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJohn (J5) Palmieri <quinticent@phuket.(none)>2006-07-12 21:28:39 -0400
committerJohn (J5) Palmieri <quinticent@phuket.(none)>2006-07-12 21:28:39 -0400
commit7a0389c01ac8c775b7b677bcc20cc0da716b1c19 (patch)
treecb5e85392161814e6f7e630facca0448dae13eb2 /tools
parent303a9d690767dd40e75940f9e3c4e1d1fa504554 (diff)
downloaddbus-python-7a0389c01ac8c775b7b677bcc20cc0da716b1c19.tar.gz
* Add tests back
* create a check command for distutils (python setup.py check)
Diffstat (limited to 'tools')
-rwxr-xr-xtools/run-with-tmp-session-bus.sh65
-rw-r--r--tools/session.conf24
2 files changed, 89 insertions, 0 deletions
diff --git a/tools/run-with-tmp-session-bus.sh b/tools/run-with-tmp-session-bus.sh
new file mode 100755
index 0000000..0ebf228
--- /dev/null
+++ b/tools/run-with-tmp-session-bus.sh
@@ -0,0 +1,65 @@
+#! /bin/bash
+
+SCRIPTNAME=$0
+WRAPPED_SCRIPT=$1
+shift
+
+function 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
+ exit 1
+}
+
+if test -z "$DBUS_TOP_BUILDDIR" ; then
+ die "Must set DBUS_TOP_BUILDDIR"
+fi
+
+## convenient to be able to ctrl+C without leaking the message bus process
+trap 'die "Received SIGINT"' SIGINT
+
+CONFIG_FILE=./run-with-tmp-session-bus.conf
+SERVICE_DIR="`pwd`/test/data/valid-service-files"
+ESCAPED_SERVICE_DIR=`echo $SERVICE_DIR | sed -e 's/\//\\\\\\//g'`
+echo "escaped service dir is: $ESCAPED_SERVICE_DIR" >&2
+
+## create a configuration file based on the standard session.conf
+cat tools/session.conf | \
+ sed -e 's/<servicedir>.*$/<servicedir>'$ESCAPED_SERVICE_DIR'<\/servicedir>/g' | \
+ sed -e 's/<include.*$//g' \
+ > $CONFIG_FILE
+
+echo "Created configuration file $CONFIG_FILE" >&2
+
+export PATH=$DBUS_TOP_BUILDDIR/bus:$PATH
+## the libtool script found by the path search should already do this, but
+export LD_LIBRARY_PATH=$DBUS_TOP_BUILDDIR/dbus/.libs:$LD_LIBRARY_PATH
+
+unset DBUS_SESSION_BUS_ADDRESS
+unset DBUS_SESSION_BUS_PID
+
+#export DBUS_VERBOSE=1
+echo "Running dbus-launch --sh-syntax --config-file=$CONFIG_FILE" >&2
+eval `dbus-launch --sh-syntax --config-file=$CONFIG_FILE`
+
+if test -z "$DBUS_SESSION_BUS_PID" ; then
+ die "Failed to launch message bus for introspection generation to run"
+fi
+
+echo "Started bus pid $DBUS_SESSION_BUS_PID at $DBUS_SESSION_BUS_ADDRESS" >&2
+
+# Execute wrapped script
+echo "Running $WRAPPED_SCRIPT $@" >&2
+$WRAPPED_SCRIPT "$@" || die "script \"$WRAPPED_SCRIPT\" failed"
+
+kill -TERM $DBUS_SESSION_BUS_PID || die "Message bus vanished! should not have happened" && echo "Killed daemon $DBUS_SESSION_BUS_PID" >&2
+
+sleep 2
+
+## be sure it really died
+kill -9 $DBUS_SESSION_BUS_PID > /dev/null 2>&1 || true
+
+exit 0
diff --git a/tools/session.conf b/tools/session.conf
new file mode 100644
index 0000000..73a38f1
--- /dev/null
+++ b/tools/session.conf
@@ -0,0 +1,24 @@
+<!-- This configuration file controls the per-user-login-session message bus.
+ Add a session-local.conf and edit that rather than changing this
+ file directly. -->
+
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+ <!-- Our well-known bus type, don't change this -->
+ <type>session</type>
+
+ <listen>unix:tmpdir=./</listen>
+
+ <servicedir></servicedir>
+
+ <policy context="default">
+ <!-- Allow everything to be sent -->
+ <allow send_destination="*"/>
+ <!-- Allow everything to be received -->
+ <allow eavesdrop="true"/>
+ <!-- Allow anyone to own anything -->
+ <allow own="*"/>
+ </policy>
+
+</busconfig>