1
0
Fork 0

Stop using xvfb-run in tests

Except the X11 backend test, it still needs an X server. Eventually we
can replace it with the equivalent that uses Xwayland, but that needs a
"scaled down" mutter that runs as the host compositor for Xwayland, that
doesn't expose anything on the session bus.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3812>
This commit is contained in:
Jonas Ådahl 2024-06-15 22:39:09 +02:00 committed by Marge Bot
parent cb5b2dbaa7
commit 16efcd4f9a
5 changed files with 37 additions and 32 deletions

View file

@ -516,18 +516,18 @@ build-wayland-only@x86_64:
- .test-mutter-base
script:
- glib-compile-schemas $GSETTINGS_SCHEMA_DIR
- xvfb-run -a -s "$XVFB_SERVER_ARGS"
./src/tests/meta-dbus-runner.py
--launch=pipewire
--launch=wireplumber
--
meson test
-C build
--setup plain
--no-suite 'mutter/kvm'
--no-rebuild
--timeout-multiplier 10
--print-errorlogs
- mkdir -m 1777 /tmp/.X11-unix
- ./src/tests/meta-dbus-runner.py
--launch=pipewire
--launch=wireplumber
--
meson test
-C build
--setup plain
--no-suite 'mutter/kvm'
--no-rebuild
--timeout-multiplier 10
--print-errorlogs
artifacts:
reports:
junit: "build/meson-logs/testlog-plain.junit.xml"
@ -614,7 +614,8 @@ can-run-gnome-shell@x86_64:
- .gitlab-ci/checkout-gnome-shell.sh
- meson setup gnome-shell gnome-shell/build --prefix /usr -Dbuildtype=debugoptimized -Dman=false --werror --fatal-meson-warnings
- sudo meson install -C gnome-shell/build
- dbus-run-session -- xvfb-run meson test -C gnome-shell/build --no-rebuild --timeout-multiplier 5
- mkdir -m 1777 /tmp/.X11-unix
- dbus-run-session -- meson test -C gnome-shell/build --no-rebuild --timeout-multiplier 5
artifacts:
expire_in: 7 day
name: "mutter-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
@ -685,12 +686,12 @@ dist-mutter:
- meson setup . build --werror --prefix /usr
-Dbuildtype=debugoptimized
- glib-compile-schemas $GSETTINGS_SCHEMA_DIR
- xvfb-run -a -s "$XVFB_SERVER_ARGS"
./src/tests/meta-dbus-runner.py
--launch=pipewire
--launch=wireplumber
--
meson dist -C build
- mkdir -m 1777 /tmp/.X11-unix
- ./src/tests/meta-dbus-runner.py
--launch=pipewire
--launch=wireplumber
--
meson dist -C build
artifacts:
expire_in: 7 day
name: "mutter-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"

View file

@ -92,11 +92,9 @@ Renderdoc is usually the better tool to debug something with, but it's also hard
```sh
export XDG_RUNTIME_DIR=$PWD/runtime-dir
mkdir -p $XDG_RUNTIME_DIR
./src/tests/meta-dbus-runner.py xvfb-run meson test -C build --setup plain --gdb failing-test-case
./src/tests/meta-dbus-runner.py meson test -C build --setup plain --gdb failing-test-case
```
The need for `xvfb-run` depends on whether the test case uses the nested backend or the headless backend.
If it involves screen casting, it becomes a bit more complicated:
```sh

View file

@ -351,6 +351,7 @@ have_native_tests = false
have_kvm_tests = false
have_tty_tests = false
have_installed_tests = false
have_x11_tests = false
if have_tests
gtk3_dep = dependency('gtk+-3.0', version: gtk3_req)
@ -417,13 +418,12 @@ if have_tests
add_test_setup('plain')
xvfb = find_program('xvfb-run')
xvfb_args = [
'-a',
'-s',
'+iglx -noreset',
]
xvfb_command = [xvfb] + xvfb_args
if have_x11
xvfb = find_program('xvfb-run', required: false)
if xvfb.found()
have_x11_tests = true
endif
endif
add_test_setup('CI',
env: [
@ -431,7 +431,6 @@ if have_tests
],
exe_wrapper: [
default_test_wrappers,
xvfb_command,
],
timeout_multiplier: 10,
)
@ -759,5 +758,6 @@ summary('Core tests', have_core_tests, section: 'Tests')
summary('Cogl tests', have_cogl_tests, section: 'Tests')
summary('Clutter tests', have_clutter_tests, section: 'Tests')
summary('KVM tests', get_option('kvm_tests'), section: 'Tests')
summary('X11 backend', have_x11_tests, section: 'Tests')
summary('Installed tests', have_installed_tests, section: 'Tests')
summary('Coverage', get_option('b_coverage'), section: 'Tests')

View file

@ -828,7 +828,13 @@ if have_kvm_tests or have_tty_tests
endif
endif
if have_x11
if have_x11_tests
xvfb_args = [
'-a',
'-s',
'+iglx -noreset',
]
foreach mode: ['', 'sync']
x11_env = test_env
if mode == 'sync'

View file

@ -4,6 +4,6 @@ Description=Mutter stacking test: @stacking_test@
# a solution for
# https://gitlab.gnome.org/GNOME/gnome-desktop-testing/-/issues/1,
# and anyway that wouldn't be sufficient to handle XDG_RUNTIME_DIR
Exec=sh -ec 'env GSETTINGS_BACKEND=memory XDG_CURRENT_DESKTOP= XDG_RUNTIME_DIR="$(mktemp -d -t mutter-@apiversion@-@stacking_test@-XXXXXX)" @libexecdir@/installed-tests/mutter-@apiversion@/mutter-installed-dbus-session.py xvfb-run -a -s "+iglx -noreset" -- @libexecdir@/installed-tests/mutter-@apiversion@/mutter-test-runner @tests_datadir@/stacking/@stacking_test@.metatest'
Exec=sh -ec 'env GSETTINGS_BACKEND=memory XDG_CURRENT_DESKTOP= XDG_RUNTIME_DIR="$(mktemp -d -t mutter-@apiversion@-@stacking_test@-XXXXXX)" @libexecdir@/installed-tests/mutter-@apiversion@/mutter-installed-dbus-session.py -- @libexecdir@/installed-tests/mutter-@apiversion@/mutter-test-runner @tests_datadir@/stacking/@stacking_test@.metatest'
Type=session
Output=TAP