Merge branch 'master' of git://git.pcp.io/pcp into qt
[pcp.git] / qa / common.qt
blob300a19125cbedb1b726d5f0945a80e9f478598c0
1 # get standard environment, filters and checks
2 . ./common.product
3 . ./common.filter
4 . ./common.check
6 . ./common.config
8 export PCP_STDERR=""
10 host=`hostname`
12 _check_display
14 # hackery for dbus-based environments
16 unset DBUS_SESSION_BUS_PID DBUS_SESSION_BUS_ADDRESS
17 if which dbus-daemon >/dev/null 2>&1
18 then
19     # recipe based on
20     # https://github.com/flatpak/flatpak/commit/6cc8062cfb3f9410d54a27e7ccca77c103e441e8
21     # to address https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=836285
22     # 
23     dbus-daemon --fork --session --print-address=3 --print-pid=4 3>$tmp.dbus.address 4>$tmp.dbus.pid
24     export DBUS_SESSION_BUS_ADDRESS="`cat $tmp.dbus.address`"
25     DBUS_SESSION_BUS_PID="`cat $tmp.dbus.pid`"
26     if kill -0 "$DBUS_SESSION_BUS_PID" >/dev/null 2>&1
27     then
28         :
29     else
30         echo "common.qt: Failed to start dbus-daemon"
31     fi
34 # general trap handler cleanup routine for qt checkers
35 _cleanup_qt()
37     # if we started a dbus-daemon above, we should clean it up
38     [ -z "$DBUS_SESSION_BUS_PID" ] || kill $DBUS_SESSION_BUS_PID
39     unset DBUS_SESSION_BUS_PID DBUS_SESSION_BUS_ADDRESS
40     $sudo rm -rf $tmp.*