[mutter] tests: Add ways to run privileged tests without KVM



commit 812954b22c2c835816f80637edef27a332be4799
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Mon Dec 13 10:39:45 2021 +0100

    tests: Add ways to run privileged tests without KVM
    
    These will be skipped by default, but can be run from a TTY for easier
    debugging by doing:
    
        dbus-run-session -- meson test -C build --suite mutter/native/tty --setup plain
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2151>

 meson.build           |  7 +++++++
 meson_options.txt     |  6 ++++++
 src/tests/meson.build | 16 +++++++++++++++-
 3 files changed, 28 insertions(+), 1 deletion(-)
---
diff --git a/meson.build b/meson.build
index 63372c2ba5..fe57114efa 100644
--- a/meson.build
+++ b/meson.build
@@ -271,6 +271,7 @@ have_cogl_tests = false
 have_clutter_tests = false
 have_native_tests = false
 have_kvm_tests = false
+have_tty_tests = false
 have_installed_tests = false
 
 if have_tests
@@ -298,6 +299,12 @@ if have_tests
       error('KVM tests are only supported on x86_64')
     endif
   endif
+  have_tty_tests = get_option('tty_tests')
+  if have_tty_tests
+    if not have_native_backend
+      error('TTY tests need the native backend tests')
+    endif
+  endif
 
   have_cogl_tests = get_option('cogl_tests')
   have_clutter_tests = get_option('clutter_tests')
diff --git a/meson_options.txt b/meson_options.txt
index 12457d2614..048a62b375 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -153,6 +153,12 @@ option('kvm_kernel_image',
   description: 'Path to a Linux kernel image to be used for KVM testing'
 )
 
+option('tty_tests',
+  type: 'boolean',
+  value: false,
+  description: 'Enable tests that must be run on a TTY (KMS tests without KVM)'
+)
+
 option('profiler',
   type: 'boolean',
   value: true,
diff --git a/src/tests/meson.build b/src/tests/meson.build
index 0a0fa7a804..879b89e876 100644
--- a/src/tests/meson.build
+++ b/src/tests/meson.build
@@ -395,7 +395,7 @@ if have_native_tests
   )
 endif
 
-if have_kvm_tests
+if have_kvm_tests or have_tty_tests
   privileged_tests = [
     [ 'kms-render', native_kms_render_tests ],
   ]
@@ -403,4 +403,18 @@ if have_kvm_tests
   if have_kvm_tests
     subdir('kvm')
   endif
+
+  if have_tty_tests
+    foreach test: privileged_tests
+      test_name = test[0]
+      test_executable = test[1]
+
+      test('native-' + test_name, test_executable,
+        suite: ['core', 'mutter/native/tty'],
+        env: test_env,
+        is_parallel: false,
+        timeout: 60,
+      )
+    endforeach
+  endif
 endif


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