From b50353ba235b5c37acfbc58ef3956346dfc5b757 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Thu, 4 Aug 2022 16:33:50 +0200 Subject: [PATCH] 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: --- meson.build | 8 ++++++++ meson_options.txt | 6 ++++++ src/tests/kvm/meson.build | 7 +++++++ 3 files changed, 21 insertions(+) diff --git a/meson.build b/meson.build index 739b249a8..cce2d74db 100644 --- a/meson.build +++ b/meson.build @@ -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, diff --git a/meson_options.txt b/meson_options.txt index da755393c..61b99d9e0 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -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' +) diff --git a/src/tests/kvm/meson.build b/src/tests/kvm/meson.build index 247bdf357..973a417ab 100644 --- a/src/tests/kvm/meson.build +++ b/src/tests/kvm/meson.build @@ -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,