gtk3 a11y tests: Always use dbus-daemon for the AT-SPI bus

at-spi-bus-launcher launches a separate DBus instance for
AT-SPI, and prefers dbus-broker over dbus-daemon when the
corresponding build option was set and dbus-broker is present.

However, trying to launch a bus using dbus-broker fails
in the environment created for the gtk3 a11y tests, which
are run using `xvfb-run` and use a separate session bus
created using `dbus-launch`, (i.e. the dbus-daemon
implementation).

See [1] (and other messages of that email thread) and [2]
for more details.

Avoid the problem of mixing different DBus implementations
by setting an environment variable that makes at-spi-bus-launcher
use dbus-daemon instead of dbus-broker regardless of how
it was configured at build time.

This depends on at-spi2-core commit [3] for at-spi-bus-launcher
to actually evaluate the environment variable:

    commit e735ed9135517532d37f7dab546786f8b4d39283
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Wed Jul 31 11:27:27 2024 +0200

        at-spi-bus-launcher: Introduce env var to select DBus implementation

        In at-spi-bus-launcher, introduce evaluation
        of an environment variable `ATSPI_DBUS_IMPLEMENTATION`
        to allow explicitly overriding the DBus implementation
        to use.

        In case of `ATSPI_DBUS_IMPLEMENTATION=dbus-daemon`, don't try
        to use dbus-broker, and vice versa.

        This can e.g. be useful for tests in environments where
        dbus-broker is installed and was configured as the
        preferred DBus implementation at at-spi2-core build time,
        but cannot be run in the test environment, e.g. when
        tests are run via

            xvfb-run --auto-servernum dbus-run-session [...]

        Thanks to Colomban Wendling for mentioning that idea
        in [1].

        [1] https://gitlab.gnome.org/GNOME/at-spi2-core/-/issues/49#note_1854645

        Related: #49

This makes

    make CppunitTest_vcl_gtk3_a11y

pass on a current Fedora Rawhide when using a self-built at-spi2-core
from its git main branch.

[1] https://lists.freedesktop.org/archives/libreoffice/2023-August/090853.html
[2] https://gitlab.gnome.org/GNOME/at-spi2-core/-/issues/49
[3] e735ed9135

Change-Id: Ifd84ef1f993398423ac0e0f695c1c0323adf02b7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171366
Reviewed-by: Colomban Wendling <cwendling@hypra.fr>
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
This commit is contained in:
Michael Weghorn 2024-08-01 08:38:05 +02:00
parent 0a9135e0d9
commit ca74f594d6

View File

@ -11,6 +11,9 @@
$(call gb_CppunitTest_get_target,vcl_gtk3_a11y) : gb_TEST_ENV_VARS += SAL_USE_VCLPLUGIN=gtk3
# force running with the X11 Gdk backend also when running on Wayland
$(call gb_CppunitTest_get_target,vcl_gtk3_a11y) : gb_TEST_ENV_VARS += GDK_BACKEND=x11
# set env var for at-spi-bus-launcher to use dbus-daemon also if dbus-broker is default;
# the latter doesn't work in the session created by xvfb-run and dbus-launch
$(call gb_CppunitTest_get_target,vcl_gtk3_a11y) : gb_TEST_ENV_VARS += ATSPI_DBUS_IMPLEMENTATION=dbus-daemon
ifeq (,$(VCL_GTK3_TESTS_NO_XVFB))
$(call gb_CppunitTest_get_target,vcl_gtk3_a11y) : \
ICECREAM_RUN += $(XVFB_RUN) --auto-servernum $(DBUS_LAUNCH) --exit-with-session