office-gobmx/vcl/CppunitTest_vcl_gtk3_a11y.mk
Michael Weghorn ca74f594d6 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
2024-08-01 10:18:19 +02:00

66 lines
2.2 KiB
Makefile

# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# hack plugging into the CppunitTest machinery yet using a xvfb-wrapper GTK3 run
$(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
endif
$(eval $(call gb_CppunitTest_CppunitTest,vcl_gtk3_a11y))
$(eval $(call gb_CppunitTest_add_exception_objects,vcl_gtk3_a11y, \
vcl/qa/cppunit/a11y/atspi2/atspiwrapper \
vcl/qa/cppunit/a11y/atspi2/atspi2 \
vcl/qa/cppunit/a11y/atspi2/atspi2text \
))
$(eval $(call gb_CppunitTest_set_include,vcl_gtk3_a11y,\
$$(INCLUDE) \
$$(ATSPI2_CFLAGS) \
))
$(eval $(call gb_CppunitTest_add_libs,vcl_gtk3_a11y,\
$$(ATSPI2_LIBS) \
))
$(eval $(call gb_CppunitTest_use_libraries,vcl_gtk3_a11y, \
sal \
cppu \
subsequenttest \
test \
i18nlangtag \
unotest \
vcl \
))
$(eval $(call gb_CppunitTest_use_externals,vcl_gtk3_a11y,\
boost_headers \
))
$(eval $(call gb_CppunitTest_use_api,vcl_gtk3_a11y,\
offapi \
udkapi \
))
$(eval $(call gb_CppunitTest_use_sdk_api,vcl_gtk3_a11y))
$(eval $(call gb_CppunitTest_use_rdb,vcl_gtk3_a11y,services))
$(eval $(call gb_CppunitTest_use_ure,vcl_gtk3_a11y))
$(eval $(call gb_CppunitTest_use_vcl,vcl_gtk3_a11y))
$(eval $(call gb_CppunitTest_use_instdir_configuration,vcl_gtk3_a11y))
$(eval $(call gb_CppunitTest_use_common_configuration,vcl_gtk3_a11y))
# vim: set noet sw=4 ts=4: