File: test_server

package info (click to toggle)
ruby-dbus 0.16.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 520 kB
  • sloc: ruby: 3,786; sh: 53; makefile: 8
file content (39 lines) | stat: -rwxr-xr-x 756 bytes parent folder | download | duplicates (5)
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

"$@"