meson: Make default test setup with D-Bus

This makes sure that our tests run within their own D-Bus session (which
is a requirement most of the time)

As a result, we can get rid of a few workarounds in our CI to setup such
a session.
This commit is contained in:
Niels De Graef 2023-01-15 23:30:17 +01:00
parent 33a4de59a2
commit 4c98a9cd6b
2 changed files with 6 additions and 14 deletions

View File

@ -9,12 +9,9 @@ variables:
fedora:Werror: fedora:Werror:
stage: build stage: build
before_script:
- dbus-uuidgen --ensure
script: script:
- meson _build -Dwerror=true -Dc_args=-Wno-error=deprecated-declarations -Dgtk_doc=false - meson _build -Dwerror=true -Dc_args=-Wno-error=deprecated-declarations -Dgtk_doc=false
- meson compile -C _build - meson compile -C _build
- eval `dbus-launch --sh-syntax`
- meson test -C _build - meson test -C _build
artifacts: artifacts:
when: on_failure when: on_failure
@ -23,12 +20,9 @@ fedora:Werror:
fedora:asan: fedora:asan:
stage: build stage: build
before_script:
- dbus-uuidgen --ensure
script: script:
- meson _build -Db_sanitize=address -Dgtk_doc=false -Dintrospection=false - meson _build -Db_sanitize=address -Dgtk_doc=false -Dintrospection=false
- meson compile -C _build - meson compile -C _build
- eval `dbus-launch --sh-syntax`
- meson test -C _build - meson test -C _build
allow_failure: true allow_failure: true
artifacts: artifacts:
@ -38,12 +32,9 @@ fedora:asan:
fedora:ubsan: fedora:ubsan:
stage: build stage: build
before_script:
- dbus-uuidgen --ensure
script: script:
- meson _build -Db_sanitize=undefined -Dgtk_doc=false - meson _build -Db_sanitize=undefined -Dgtk_doc=false
- meson compile -C _build - meson compile -C _build
- eval `dbus-launch --sh-syntax`
- meson test -C _build - meson test -C _build
artifacts: artifacts:
when: on_failure when: on_failure
@ -52,8 +43,6 @@ fedora:ubsan:
fedora-static-analyzers/test: fedora-static-analyzers/test:
stage: build stage: build
before_script:
- dbus-uuidgen --ensure
script: script:
- meson _build -Dgtk_doc=false - meson _build -Dgtk_doc=false
- meson compile -C _build --ninja-args scan-build - meson compile -C _build --ninja-args scan-build
@ -65,12 +54,9 @@ fedora-static-analyzers/test:
fedora:coverage: fedora:coverage:
stage: build stage: build
before_script:
- dbus-uuidgen --ensure
script: script:
- meson _build -Db_coverage=true -Dtpm2=true -Dgtk_doc=false - meson _build -Db_coverage=true -Dtpm2=true -Dgtk_doc=false
- meson compile -C _build - meson compile -C _build
- eval `dbus-launch --sh-syntax`
- export XDG_CONFIG_HOME=$HOME/.config - export XDG_CONFIG_HOME=$HOME/.config
- /usr/share/swtpm/swtpm-create-user-config-files --root - /usr/share/swtpm/swtpm-create-user-config-files --root
- mkdir -p ${XDG_CONFIG_HOME}/mytpm1 - mkdir -p ${XDG_CONFIG_HOME}/mytpm1

View File

@ -75,6 +75,12 @@ configure_file(output: 'config.h', configuration: conf)
test_env = environment() test_env = environment()
test_env.set('abs_top_builddir', meson.build_root()) test_env.set('abs_top_builddir', meson.build_root())
# Most tests require a D-Bus session
add_test_setup('headless',
exe_wrapper: find_program('dbus-run-session'),
is_default: true,
)
# Subfolders # Subfolders
subdir('po') subdir('po')
subdir('egg') subdir('egg')