dbus unit tests and $DISPLAY

Simon McVittie simon.mcvittie at collabora.co.uk
Wed Jun 11 03:03:02 PDT 2014

On 10/06/14 23:39, Colin Walters wrote:
> The current Fedora dbus package runs "make check" per request of Red
> Hat's QA team.

Note that if you re-./configure D-Bus with --enable-tests *in the same
build directory*, you need to be really careful that you are not
accidentally installing the version that has tests enabled, which is
much more likely to be have security vulnerabilities (and I'm not sure
we'd even handle them as security vulnerabilities if they were only
exploitable in the --enable-embedded-tests configuration).

In Debian we do three out-of-tree builds: a "production build" with
--enable-installed-tests --disable-embedded-tests --disable-verbose and
installed to ${exec_prefix}, a "debug build" with all debug features
enabled and installed to ${libdir}/dbus-1.0/debug-build, and a special
minimal build for debian-installer with all optional features disabled.
Other packages link against the production build, but developers can use
LD_PRELOAD or LD_LIBRARY_PATH to pull in the debug build instead, e.g.
to get better valgrind traces. We don't run "make check" while building
the packages as noted above, but we do run the installed-tests via
autopkgtest on ci.debian.net.

I briefly tried to do "make check" on the buildds, but gave up when I
hit <http://bugs.debian.org/630152> (Debian buildds run as a user whose
"official" home directory in /etc/passwd does not exist, as a technical
way to enforce the policy that package builds should not write to
$HOME). Maybe one day I'll write a patch for libdbus to make it believe
$HOME instead of /etc/passwd if (it is not setuid and) the uid in
question matches our own.

Build rules:

Installed tests:

> However, several unit tests in DBus require an active X
> server, which isn't available at package build time.

I believe that ought to be exactly one test, test-autolaunch. What are
the others, if any?

test-autolaunch is not particularly useful (making it work in more
situations has meant that it doesn't actually test very much any more)
and I would be delighted to review a patch to replace it with something
more meaningful - perhaps using Xvfb unconditionally, and skipping the
test if that binary isn't available. (For instance, that would let us
test assertions like "when the X server disconnects us, dbus-daemon is

Debian's Xvfb package contains a script "xvfb-run" which might be useful.


More information about the dbus mailing list