How to make automated tests for clients of D-Bus system service?
smcv at collabora.com
Tue Feb 6 13:46:48 UTC 2018
On Tue, 06 Feb 2018 at 14:32:49 +0100, Miroslav Kravec wrote:
> How do I start own dbus-daemon?
Look at how python-dbusmock does it (I think it has convenience code to
do that for you?), or at the other examples I linked. The tl;dr version
is something like this:
dbus-daemon --fork --config=your-config-file-here \
--print-address=3 --print-pid=4 3>address.txt 4>pid.txt
Now your bus address is in address.txt, and the process ID to kill
afterwards is in pid.txt. (Or use pipes.)
> $ dbus-daemon --print-address
> No configuration file specified.
You'll need a configuration file that looks like a hybrid of the session
bus and the system bus, and optionally picks up .service files from a
directory that you control (or you can run the mock service explicitly
and wait for it to appear instead). python-dbusmock probably has some
examples of this. If not, test/name-test/tmp-session-like-system.conf
in dbus.git is the sort of thing I mean.
More information about the dbus