1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
#! /bin/sh
# A wrapper for DBus tests
# Run a server (directly or by dbus activation) and then the test
# $0 server [args...] -- test [args...]
set -o errexit
while [ "$1" != "--" ]; do
SERVER="$SERVER $1"
shift
done
shift # --
setup_activation () {
SDIR=$XDG_DATA_DIRS/dbus-1/services
mkdir -p $SDIR
# FIXME Name is hardcoded
cat <<EOF > $SDIR/test.service
[D-BUS Service]
Name=org.ruby.service
Exec=$SERVER
EOF
}
run_server () {
echo -n "Hey, server, get on da bus... "
# start the server
$SERVER & sleep 3
echo "off we go!"
}
export XDG_DATA_DIRS=`mktemp -d dbus.activation.XXXXXX`
RM_FILES="$RM_FILES $XDG_DATA_DIRS"
setup_activation
#run_server
# Clean up at exit.
trap "rm -rf \$RM_FILES" EXIT TERM INT
"$@"
|