vcl/CppunitTest_vcl_gtk3_a11y.mk |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit ca01deadcbc480b6e79618b227a2b73a61ecb7ff
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Mon Oct 16 11:03:46 2023 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Tue Oct 17 07:50:37 2023 +0200

    gtk3 a11y test: Let xvfb-run auto-determine free server num
    
    As the xvfb-run manpage says, it uses a default server number of 99:
    
    >      -n servernumber, --server-num=servernumber
    >             Use servernumber as the server number (but see the -a, 
--auto-servernum option above).  The default is 99.
    
    The gtk3 a11y tests use xvfb-run. Running the test multiple
    times in parallel (e.g. when doing two separate builds with
    tests, as happens on CI) would fall like this on Debian testing:
    
        $ make CppunitTest_vcl_gtk3_a11y
        make -j 12 -rs -f 
/home/michi/development/git/libreoffice/Makefile.gbuild 
CppunitTest_vcl_gtk3_a11y
        [CUT] vcl_gtk3_a11y
        xvfb-run: error: Xvfb failed to start
        Hint: You are currently not seeing messages from other users and the 
system.
              Users in groups 'adm', 'systemd-journal' can see all messages.
              Pass -q to turn off this notice.
        No coredumps found.
    
        Error: a unit test failed, please do one of:
    
        make CppunitTest_vcl_gtk3_a11y CPPUNITTRACE="gdb --args"
            # for interactive debugging on Linux
        make CppunitTest_vcl_gtk3_a11y VALGRIND=memcheck
            # for memory checking
        make CppunitTest_vcl_gtk3_a11y DEBUGCPPUNIT=TRUE
            # for exception catching
    
        You can limit the execution to just one particular test by:
    
        make CPPUNIT_TEST_NAME="testXYZ" ...above mentioned params...
    
    However, it behaves differently on Alma Linux 8, where it
    looks like xvfb-run seems then to reuse the existing
    Xfvb session, causing the tests to potentially find
    the LibreOffice instance from another test run, and
    then inspecting the wrong one, leading to failures
    like the one in [1]:
    
        equality assertion failed
        - Expected: ecclectic.fodt — LibreOfficeDev Writer
        - Actual  : ecclectic.fodt — LibreOfficeDev Writer 24.2 
[9bc2aede99017ed0338e97b21b4735919b705b47]
    
    The fact that the second instance of xvfb-run
    reuses the session of the firs one and finds the
    LibreOffice there can also be reproduced on Alma Linux 8
    by just running these 2 commands in parallel:
    
    1) start LO in xfvb-run session:
    
        $ xvfb-run dbus-launch libreoffice
    
    2) run below Python script that lists the
       running applications:
    
        $ xvfb-run dbus-launch python3 /home/vagrant/atspi-list-apps.py
        --------start--------
        [application | soffice]
        --------end--------
        /usr/bin/xvfb-run: line 186: kill: (27078) - No such process
    
    This *should not* list the applications from
    the other xfvb-run.
    
    It works as expected when passing `--auto-servernum`:
    
        $ xvfb-run --auto-servernum dbus-launch python3 
/home/vagrant/atspi-list-apps.py
        --------start--------
        --------end--------
    
    Therefore, pass the `--auto-servernum` arg to xvfb-run, so that it
    automatically determines a free server number instead.
    
    >      -a, --auto-servernum
    >             Try to get a free server number, starting at 99, or the 
argument to --server-num.
    
    Python script mentioned above used for testing:
    
        $ cat atspi-list-apps.py
        #!/usr/bin/python3
    
        import pyatspi
    
        registry = pyatspi.registry.Registry()
        apps = list(registry.getDesktop(0))
    
        print('--------start--------')
    
        for app in apps:
            print(f'{app}')
    
        print('--------end--------')
    
    [1] 
https://ci.libreoffice.org/job/gerrit_linux_gcc_release/151750/consoleFull#-1985341263d893063f-7f3d-4b7e-b56f-4e0f225817cd
    
    Change-Id: I0673212fb8fed5c9698c9f797b7bf49ba51033b0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158021
    Tested-by: Jenkins
    Reviewed-by: Colomban Wendling <cwendl...@hypra.fr>
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/CppunitTest_vcl_gtk3_a11y.mk b/vcl/CppunitTest_vcl_gtk3_a11y.mk
index 19adbabd4d14..476f80334442 100644
--- a/vcl/CppunitTest_vcl_gtk3_a11y.mk
+++ b/vcl/CppunitTest_vcl_gtk3_a11y.mk
@@ -13,7 +13,7 @@ $(call gb_CppunitTest_get_target,vcl_gtk3_a11y) : 
gb_TEST_ENV_VARS += SAL_USE_VC
 $(call gb_CppunitTest_get_target,vcl_gtk3_a11y) : gb_TEST_ENV_VARS += 
GDK_BACKEND=x11
 ifeq (,$(VCL_GTK3_TESTS_NO_XVFB))
 $(call gb_CppunitTest_get_target,vcl_gtk3_a11y) : \
-       ICECREAM_RUN += $(XVFB_RUN) $(DBUS_LAUNCH) --exit-with-session
+       ICECREAM_RUN += $(XVFB_RUN) --auto-servernum $(DBUS_LAUNCH) 
--exit-with-session
 endif
 
 $(eval $(call gb_CppunitTest_CppunitTest,vcl_gtk3_a11y))

Reply via email to