[mutter] Add 'catch' option



commit b50353ba235b5c37acfbc58ef3956346dfc5b757
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Thu Aug 4 16:33:50 2022 +0200

    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>

 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 739b249a84..cce2d74dbc 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 da755393c7..61b99d9e04 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 247bdf3574..973a417abc 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,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]