3 # This script is modified from dbus's run-with-temp-session-bus.sh.
10 if ! test -z "$DBUS_SESSION_BUS_PID" ; then
11 echo "killing message bus "$DBUS_SESSION_BUS_PID >&2
12 kill -9 $DBUS_SESSION_BUS_PID
14 echo $SCRIPTNAME: $* >&2
18 ## convenient to be able to ctrl+C without leaking the message bus process
19 trap 'die "Received SIGINT"' INT
21 unset DBUS_SESSION_BUS_ADDRESS
22 unset DBUS_SESSION_BUS_PID
24 echo "Running dbus-launch --sh-syntax" >&2
26 eval `dbus-launch --sh-syntax`
28 if test -z "$DBUS_SESSION_BUS_PID" ; then
29 die "Failed to launch message bus for test script to run"
32 echo "Started bus pid $DBUS_SESSION_BUS_PID at $DBUS_SESSION_BUS_ADDRESS" >&2
34 TEMP_PULSE_DIR=`mktemp -d`
35 export PULSE_RUNTIME_PATH=${TEMP_PULSE_DIR}
37 # this script would be called inside src/ directory, so we need to use the correct path.
38 # notice that for tests, we don't load ALSA related modules.
40 --log-target=file:${PWD}/pulse-daemon.log \
42 --load="module-null-sink" \
43 --load="module-null-source" \
44 --load="module-suspend-on-idle" \
45 --load="module-native-protocol-unix" \
46 --load="module-cli-protocol-unix" \
47 --dl-search-path="$(dirname $SCRIPTNAME)/.libs/" \
50 # wait a few seconds to let the daemon start!
57 for ONE_TEST in $@; do
58 ${ONE_TEST} || EXIT_CODE=1
61 # terminate the designated pulseaudio daemon
66 kill -TERM $DBUS_SESSION_BUS_PID || die "Message bus vanished! should not have happened" && echo "Killed daemon $DBUS_SESSION_BUS_PID" >&2
70 ## be sure it really died
71 kill -9 $DBUS_SESSION_BUS_PID > /dev/null 2>&1 || true