cmake: Add X11 include path for tools
[platform/upstream/dbus.git] / test / test-dbus-launch-eval.sh
1 #!/bin/sh
2
3 # Copyright © 2016 Collabora Ltd.
4 #
5 # Permission is hereby granted, free of charge, to any person
6 # obtaining a copy of this software and associated documentation files
7 # (the "Software"), to deal in the Software without restriction,
8 # including without limitation the rights to use, copy, modify, merge,
9 # publish, distribute, sublicense, and/or sell copies of the Software,
10 # and to permit persons to whom the Software is furnished to do so,
11 # subject to the following conditions:
12 #
13 # The above copyright notice and this permission notice shall be
14 # included in all copies or substantial portions of the Software.
15 #
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
20 # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21 # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 # SOFTWARE.
24
25 set -e
26
27 export DBUS_DEBUG_OUTPUT=1
28 echo "# dbus-daemon binary: ${DBUS_TEST_DAEMON:=dbus-daemon}"
29 echo "# dbus-launch binary: ${DBUS_TEST_DBUS_LAUNCH:=dbus-launch}"
30 echo "# dbus-send binary: ${DBUS_TEST_DBUS_SEND:=dbus-send}"
31 echo "# dbus-uuidgen binary: ${DBUS_TEST_DBUS_UUIDGEN:=dbus-uuidgen}"
32
33 if test -n "$DBUS_TEST_DATA"; then
34     echo "# test data: $DBUS_TEST_DATA"
35     config="--config-file=$DBUS_TEST_DATA/valid-config-files/session.conf"
36 elif test -n "$DBUS_TEST_DATADIR"; then
37     echo "# datadir: $DBUS_TEST_DATADIR"
38     config="--config-file=$DBUS_TEST_DATADIR/dbus-1/session.conf"
39 else
40     echo "# using standard session bus configuration"
41     # add a harmless command-line argument
42     config="--sh-syntax"
43 fi
44
45 if ! "${DBUS_TEST_DBUS_UUIDGEN}" --get >/dev/null; then
46     if test -n "$DBUS_TEST_UNINSTALLED"; then
47         echo "1..0 # SKIP - Unable to test dbus-launch without a machine ID"
48         exit 0
49     else
50         echo "Bail out! dbus not correctly installed: no machine ID"
51         exit 1
52     fi
53 fi
54
55 echo "1..1"
56
57 unset DBUS_SESSION_BUS_ADDRESS
58 unset DBUS_SESSION_BUS_PID
59
60 eval "$(${DBUS_TEST_DBUS_LAUNCH} --sh-syntax "$config")"
61
62 test -n "$DBUS_SESSION_BUS_ADDRESS"
63 env | grep '^DBUS_SESSION_BUS_ADDRESS='
64
65 test -n "$DBUS_SESSION_BUS_PID"
66 test "x$(env | grep '^DBUS_SESSION_BUS_PID=')" = "x"
67 kill -0 "$DBUS_SESSION_BUS_PID"
68
69 ${DBUS_TEST_DBUS_SEND} --session --dest=org.freedesktop.DBus \
70     --type=method_call --print-reply / org.freedesktop.DBus.ListNames >&2
71
72 kill "$DBUS_SESSION_BUS_PID"
73
74 echo "ok 1 - normal dbus-launch"