1#! /bin/sh
2
3die()
4{
5    if ! test -z "$DBUS_SESSION_BUS_PID" ; then
6        echo "killing message bus "$DBUS_SESSION_BUS_PID >&2
7        kill -9 $DBUS_SESSION_BUS_PID
8    fi
9    echo $SCRIPTNAME: $* >&2
10
11    exit 1
12}
13
14
15SCRIPTNAME=$0
16MODE=$1
17
18## so the tests can complain if you fail to use the script to launch them
19DBUS_TEST_NAME_RUN_TEST_SCRIPT=1
20export DBUS_TEST_NAME_RUN_TEST_SCRIPT
21
22# Rerun ourselves with tmp session bus if we're not already
23if test -z "$DBUS_TEST_NAME_IN_RUN_TEST"; then
24  DBUS_TEST_NAME_IN_RUN_TEST=1
25  export DBUS_TEST_NAME_IN_RUN_TEST
26  exec $DBUS_TOP_SRCDIR/tools/run-with-tmp-session-bus.sh $SCRIPTNAME $MODE
27fi 
28
29if test -n "$DBUS_TEST_MONITOR"; then
30  dbus-monitor --session &
31fi
32
33echo "running test-ids"
34${DBUS_TOP_BUILDDIR}/libtool --mode=execute $DEBUG $DBUS_TOP_BUILDDIR/test/name-test/test-ids || die "test-ids failed"
35
36echo "running test-pending-call-dispatch"
37${DBUS_TOP_BUILDDIR}/libtool --mode=execute $DEBUG $DBUS_TOP_BUILDDIR/test/name-test/test-pending-call-dispatch || die "test-pending-call-dispatch failed"
38
39echo "running test-pending-call-timeout"
40${DBUS_TOP_BUILDDIR}/libtool --mode=execute $DEBUG $DBUS_TOP_BUILDDIR/test/name-test/test-pending-call-timeout || die "test-pending-call-timeout failed"
41
42echo "running test-threads-init"
43${DBUS_TOP_BUILDDIR}/libtool --mode=execute $DEBUG $DBUS_TOP_BUILDDIR/test/name-test/test-threads-init || die "test-threads-init failed"
44
45echo "running test-privserver-client"
46${DBUS_TOP_BUILDDIR}/libtool --mode=execute $DEBUG $DBUS_TOP_BUILDDIR/test/name-test/test-privserver-client || die "test-privserver-client failed"
47
48echo "running test-shutdown"
49${DBUS_TOP_BUILDDIR}/libtool --mode=execute $DEBUG $DBUS_TOP_BUILDDIR/test/name-test/test-shutdown || die "test-shutdown failed"
50
51echo "running test activation forking"
52if test "x$PYTHON" = "x:"; then
53  echo "Skipped test-activation-forking: Python interpreter not found"
54elif ! $PYTHON $DBUS_TOP_SRCDIR/test/name-test/test-activation-forking.py; then
55  echo "Failed test-activation-forking"
56  exit 1
57fi
58
59echo "running test-autolaunch"
60${DBUS_TOP_BUILDDIR}/libtool --mode=execute $DEBUG $DBUS_TOP_BUILDDIR/test/name-test/test-autolaunch || die "test-autolaunch failed"
61