mirror of
https://github.com/brl/mutter.git
synced 2024-11-29 19:40:43 -05:00
tests/wayland: Create native backends for KVM/tty tests
Run the wayland tests also in the KVM and tty tests suits. Change some of the tests to also use a native backend via VKMS. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3350>
This commit is contained in:
parent
13bbc4bc43
commit
c8191920e8
@ -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,
|
||||
|
23
src/tests/monitor-configs/vkms-640x480.xml
Normal file
23
src/tests/monitor-configs/vkms-640x480.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<monitors version="2">
|
||||
<configuration>
|
||||
<logicalmonitor>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<scale>1</scale>
|
||||
<primary>yes</primary>
|
||||
<monitor>
|
||||
<monitorspec>
|
||||
<connector>Virtual-1</connector>
|
||||
<vendor>unknown</vendor>
|
||||
<product>unknown</product>
|
||||
<serial>unknown</serial>
|
||||
</monitorspec>
|
||||
<mode>
|
||||
<width>640</width>
|
||||
<height>480</height>
|
||||
<rate>59.94</rate>
|
||||
</mode>
|
||||
</monitor>
|
||||
</logicalmonitor>
|
||||
</configuration>
|
||||
</monitors>
|
@ -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;
|
||||
|
@ -20,6 +20,9 @@
|
||||
#include <gio/gio.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/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;
|
||||
|
Loading…
Reference in New Issue
Block a user