D-Bus unit tests

Thomas Sondergaard ts at medical-insight.com
Wed Nov 12 01:32:14 PST 2014


Hi,

I have a bunch of unit tests that use D-Bus that are run by jenkins. On 
Linux, jenkins starts an Xvnc display for me, on Windows I just have the 
jenkins users local display. I would like to be able to run my tests in 
parallel, and to that end I want each started test executable to start 
its own dbus-daemon, but I want child processes started by the test 
executable to use that same D-Bus daemon. I'm Using QtDBus (Qt 4.8, 
hopefully 5.x soon).

My thinking is that I need to do something like this:
qputenv("DBUS_SESSION_BUS_ADDRESS", "autolaunch:");
QDBusConnection::sessionBus(); // Trigger connect
qputenv("DBUS_SESSION_BUS_ADDRESS", 
getDBusAddress(QDBusConnection::sessionBus()));

Unfortunately, I don't know how to implement getDBusAddress(), but the 
autolaunch: mechanism also doesn't work as I expect. If another process 
has already been started with autolaunch: I get connected to it's 
dbus-daemon (on RHEL7 linux, haven't tried on Windows). Btw, this seems 
inconsistent with http://dbus.freedesktop.org/doc/dbus-launch.1.html 
which says "Whenever an autolaunch occurs, the application that had to 
start a new bus will be in its own little world". It is however 
consistent with 
http://dbus.freedesktop.org/doc/dbus-specification.html#meta-transports-autolaunch.

I hope you can help me with this. I'd like a solution that works on both 
Linux and Windows.

Thank you for your time
Thomas



More information about the dbus mailing list