Add 'catch' option

The catch option makes test run via 'catch'[1], which will log
backtraces whenever an abort or segmentation fault happens in any of the
subprocesses. The aim is to enable this when running in CI to help
debugging crashes that only tend to happen in CI.

While it's possible to wrap the whole meson command in 'catch', doing so
doesn't cover the KVM tests, so this option is added instead that covers
both cases.

[1] https://gitlab.gnome.org/jadahl/catch/

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2561>
This commit is contained in:
Jonas Ådahl 2022-08-04 16:33:50 +02:00
parent 510a938069
commit b50353ba23
3 changed files with 21 additions and 0 deletions

View File

@ -353,8 +353,16 @@ if have_tests
meta_dbus_runner = find_program('src/tests/meta-dbus-runner.py')
default_test_wrappers = [
meta_dbus_runner,
'--',
]
if get_option('catch')
catch = find_program('catch')
default_test_wrappers += [
catch,
]
endif
add_test_setup('default',
is_default: true,
exe_wrapper: default_test_wrappers,

View File

@ -206,3 +206,9 @@ option('xwayland_initfd',
value: 'auto',
description: 'Whether -initfd argument is passed to Xwayland to guarantee services (e.g. gsd-xsettings) startup before applications'
)
option('catch',
type: 'boolean',
value: false,
description: 'Use catch to catch backtraces'
)

View File

@ -27,6 +27,12 @@ endif
virtme_run = find_program('virtme-run.sh')
if get_option('catch')
kvm_wrapper = catch.full_path()
else
kvm_wrapper = []
endif
foreach test_case: privileged_tests
vm_env_entries = []
foreach name, value: test_case['variables']
@ -47,6 +53,7 @@ foreach test_case: privileged_tests
'--kvm',
meson.current_build_dir(),
vm_env,
kvm_wrapper,
test_case['executable'].full_path(),
],
is_parallel: false,