diff --git a/src/tests/meson.build b/src/tests/meson.build index 558105842..fff12137d 100644 --- a/src/tests/meson.build +++ b/src/tests/meson.build @@ -524,7 +524,7 @@ if have_native_tests privileged_test_cases += kms_test_cases # Wayland tests - test_cases += [ + wayland_test_cases = [ { 'name': 'wayland-client-tests', 'suite': 'wayland', @@ -587,6 +587,10 @@ if have_native_tests ], }, ] + + test_cases += wayland_test_cases + privileged_test_cases += wayland_test_cases + if have_xwayland x11_compositor_checker = executable('x11-compositor-checker', sources: ['x11-compositor-checker.c'], @@ -755,12 +759,13 @@ if have_kvm_tests or have_tty_tests variants = [['', test_env_variables, []]] endif - test_executable = executable('mutter-' + test_case['name'], + test_executable = executable('mutter-privileged-' + test_case['name'], sources: test_case['sources'], include_directories: tests_includes, c_args: [ tests_c_args, '-DG_LOG_DOMAIN="mutter-@0@-test"'.format(test_case['name']), + '-DMUTTER_PRIVILEGED_TEST=1', ], dependencies: [ libmutter_test_dep, diff --git a/src/tests/monitor-configs/vkms-640x480.xml b/src/tests/monitor-configs/vkms-640x480.xml new file mode 100644 index 000000000..d31d3ce88 --- /dev/null +++ b/src/tests/monitor-configs/vkms-640x480.xml @@ -0,0 +1,23 @@ + + + + 0 + 0 + 1 + yes + + + Virtual-1 + unknown + unknown + unknown + + + 640 + 480 + 59.94 + + + + + diff --git a/src/tests/wayland-fullscreen-test.c b/src/tests/wayland-fullscreen-test.c index 959b236ba..aea335de7 100644 --- a/src/tests/wayland-fullscreen-test.c +++ b/src/tests/wayland-fullscreen-test.c @@ -18,6 +18,9 @@ #include "config.h" #include "backends/meta-virtual-monitor.h" +#include "backends/native/meta-backend-native.h" +#include "backends/native/meta-kms.h" +#include "backends/native/meta-kms-device.h" #include "compositor/meta-window-actor-private.h" #include "core/window-private.h" #include "meta-test/meta-context-test.h" @@ -170,11 +173,29 @@ on_before_tests (void) { MetaWaylandCompositor *compositor = meta_context_get_wayland_compositor (test_context); + MetaBackend *backend = meta_context_get_backend (test_context); + MetaMonitorManager *monitor_manager = + meta_backend_get_monitor_manager (backend); +#ifdef MUTTER_PRIVILEGED_TEST + MetaKms *kms = meta_backend_native_get_kms (META_BACKEND_NATIVE (backend)); + MetaKmsDevice *kms_device = meta_kms_get_devices (kms)->data; +#endif test_driver = meta_wayland_test_driver_new (compositor); +#ifdef MUTTER_PRIVILEGED_TEST + meta_wayland_test_driver_set_property (test_driver, + "gpu-path", + meta_kms_device_get_path (kms_device)); + + meta_set_custom_monitor_config_full (backend, + "vkms-640x480.xml", + META_MONITORS_CONFIG_FLAG_NONE); +#else virtual_monitor = meta_create_test_monitor (test_context, 640, 480, 60.0); +#endif + meta_monitor_manager_reload (monitor_manager); wayland_test_client = meta_wayland_test_client_new (test_context, "fullscreen"); @@ -211,8 +232,13 @@ main (int argc, { g_autoptr (MetaContext) context = NULL; +#ifdef MUTTER_PRIVILEGED_TEST + context = meta_create_test_context (META_CONTEXT_TEST_TYPE_VKMS, + META_CONTEXT_TEST_FLAG_NO_X11); +#else context = meta_create_test_context (META_CONTEXT_TEST_TYPE_HEADLESS, META_CONTEXT_TEST_FLAG_NO_X11); +#endif g_assert (meta_context_configure (context, &argc, &argv, NULL)); test_context = context; diff --git a/src/tests/wayland-unit-tests.c b/src/tests/wayland-unit-tests.c index 3fe2de5da..aff7515a8 100644 --- a/src/tests/wayland-unit-tests.c +++ b/src/tests/wayland-unit-tests.c @@ -20,6 +20,9 @@ #include #include "backends/meta-virtual-monitor.h" +#include "backends/native/meta-backend-native.h" +#include "backends/native/meta-kms.h" +#include "backends/native/meta-kms-device.h" #include "compositor/meta-window-actor-private.h" #include "core/display-private.h" #include "core/window-private.h" @@ -27,6 +30,7 @@ #include "meta/meta-later.h" #include "meta/meta-workspace-manager.h" #include "tests/meta-test-utils.h" +#include "tests/meta-monitor-test-utils.h" #include "tests/meta-wayland-test-driver.h" #include "tests/meta-wayland-test-utils.h" #include "wayland/meta-wayland-client-private.h" @@ -835,11 +839,29 @@ on_before_tests (void) { MetaWaylandCompositor *compositor = meta_context_get_wayland_compositor (test_context); + MetaBackend *backend = meta_context_get_backend (test_context); + MetaMonitorManager *monitor_manager = + meta_backend_get_monitor_manager (backend); +#ifdef MUTTER_PRIVILEGED_TEST + MetaKms *kms = meta_backend_native_get_kms (META_BACKEND_NATIVE (backend)); + MetaKmsDevice *kms_device = meta_kms_get_devices (kms)->data; +#endif test_driver = meta_wayland_test_driver_new (compositor); +#ifdef MUTTER_PRIVILEGED_TEST + meta_wayland_test_driver_set_property (test_driver, + "gpu-path", + meta_kms_device_get_path (kms_device)); + + meta_set_custom_monitor_config_full (backend, + "vkms-640x480.xml", + META_MONITORS_CONFIG_FLAG_NONE); +#else virtual_monitor = meta_create_test_monitor (test_context, 640, 480, 60.0); +#endif + meta_monitor_manager_reload (monitor_manager); } static void @@ -876,10 +898,15 @@ init_tests (void) toplevel_apply_limits); g_test_add_func ("/wayland/toplevel/activation", toplevel_activation); +#ifdef MUTTER_PRIVILEGED_TEST + (void)(toplevel_bounds_struts); + (void)(toplevel_bounds_monitors); +#else g_test_add_func ("/wayland/toplevel/bounds/struts", toplevel_bounds_struts); g_test_add_func ("/wayland/toplevel/bounds/monitors", toplevel_bounds_monitors); +#endif g_test_add_func ("/wayland/xdg-foreign/set-parent-of", xdg_foreign_set_parent_of); } @@ -890,8 +917,13 @@ main (int argc, { g_autoptr (MetaContext) context = NULL; +#ifdef MUTTER_PRIVILEGED_TEST + context = meta_create_test_context (META_CONTEXT_TEST_TYPE_VKMS, + META_CONTEXT_TEST_FLAG_NO_X11); +#else context = meta_create_test_context (META_CONTEXT_TEST_TYPE_HEADLESS, META_CONTEXT_TEST_FLAG_NO_X11); +#endif g_assert (meta_context_configure (context, &argc, &argv, NULL)); test_context = context;