mirror of
https://github.com/brl/mutter.git
synced 2024-11-28 11:00:54 -05:00
tests: Add headless native backend test
It doesn't do anything more than construct and tear down, but it's a start. Don't run the test as part of CI yet, as doesn't have the DRM devices needed. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
This commit is contained in:
parent
9bf57f82d3
commit
78ba1429c8
@ -191,7 +191,7 @@ build-fedora-container@aarch64:
|
|||||||
- .fdo.distribution-image@fedora
|
- .fdo.distribution-image@fedora
|
||||||
stage: build
|
stage: build
|
||||||
script:
|
script:
|
||||||
- meson . build -Dbuildtype=debugoptimized -Db_coverage=true -Degl_device=true -Dwayland_eglstream=true --werror --prefix /usr
|
- meson . build -Dbuildtype=debugoptimized -Db_coverage=true -Degl_device=true -Dwayland_eglstream=true -Dnative_tests=false --werror --prefix /usr
|
||||||
- ninja -C build
|
- ninja -C build
|
||||||
- ninja -C build install
|
- ninja -C build install
|
||||||
artifacts:
|
artifacts:
|
||||||
@ -221,7 +221,7 @@ build-without-opengl-and-glx@x86_64:
|
|||||||
needs:
|
needs:
|
||||||
- build-fedora-container@x86_64
|
- build-fedora-container@x86_64
|
||||||
script:
|
script:
|
||||||
- meson . build -Dbuildtype=debugoptimized -Dopengl=false -Dglx=false -Degl_device=true -Dwayland_eglstream=true --werror --prefix /usr
|
- meson . build -Dbuildtype=debugoptimized -Dopengl=false -Dglx=false -Degl_device=true -Dwayland_eglstream=true -Dnative_tests=false --werror --prefix /usr
|
||||||
- ninja -C build
|
- ninja -C build
|
||||||
- ninja -C build install
|
- ninja -C build install
|
||||||
artifacts:
|
artifacts:
|
||||||
@ -236,7 +236,7 @@ build-without-native-backend-and-wayland@x86_64:
|
|||||||
needs:
|
needs:
|
||||||
- build-fedora-container@x86_64
|
- build-fedora-container@x86_64
|
||||||
script:
|
script:
|
||||||
- meson . build -Dbuildtype=debugoptimized -Dnative_backend=false -Dudev=false -Dwayland=false -Dcore_tests=false --werror --prefix /usr
|
- meson . build -Dbuildtype=debugoptimized -Dnative_backend=false -Dudev=false -Dwayland=false -Dcore_tests=false -Dnative_tests=false --werror --prefix /usr
|
||||||
- ninja -C build
|
- ninja -C build
|
||||||
- ninja -C build install
|
- ninja -C build install
|
||||||
artifacts:
|
artifacts:
|
||||||
|
@ -262,6 +262,7 @@ have_tests = get_option('tests')
|
|||||||
have_core_tests = false
|
have_core_tests = false
|
||||||
have_cogl_tests = false
|
have_cogl_tests = false
|
||||||
have_clutter_tests = false
|
have_clutter_tests = false
|
||||||
|
have_native_tests = false
|
||||||
have_installed_tests = false
|
have_installed_tests = false
|
||||||
|
|
||||||
if have_tests
|
if have_tests
|
||||||
@ -271,6 +272,12 @@ if have_tests
|
|||||||
error('Tests require Wayland to be enabled')
|
error('Tests require Wayland to be enabled')
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
have_native_tests = get_option('native_tests')
|
||||||
|
if have_native_tests
|
||||||
|
if not have_native_backend
|
||||||
|
error('Native tests require the native backend')
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
have_cogl_tests = get_option('cogl_tests')
|
have_cogl_tests = get_option('cogl_tests')
|
||||||
have_clutter_tests = get_option('clutter_tests')
|
have_clutter_tests = get_option('clutter_tests')
|
||||||
|
@ -117,6 +117,12 @@ option('core_tests',
|
|||||||
description: 'Enable mutter core tests'
|
description: 'Enable mutter core tests'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
option('native_tests',
|
||||||
|
type: 'boolean',
|
||||||
|
value: true,
|
||||||
|
description: 'Enable mutter native backend tests'
|
||||||
|
)
|
||||||
|
|
||||||
option('tests',
|
option('tests',
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
value: true,
|
value: true,
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "backends/native/meta-udev.h"
|
#include "backends/native/meta-udev.h"
|
||||||
|
|
||||||
#define META_TYPE_BACKEND_NATIVE (meta_backend_native_get_type ())
|
#define META_TYPE_BACKEND_NATIVE (meta_backend_native_get_type ())
|
||||||
|
META_EXPORT_TEST
|
||||||
G_DECLARE_FINAL_TYPE (MetaBackendNative, meta_backend_native,
|
G_DECLARE_FINAL_TYPE (MetaBackendNative, meta_backend_native,
|
||||||
META, BACKEND_NATIVE, MetaBackend)
|
META, BACKEND_NATIVE, MetaBackend)
|
||||||
|
|
||||||
|
@ -157,6 +157,21 @@ anonymous_file_test = executable('anonymous-file-tests',
|
|||||||
install_dir: mutter_installed_tests_libexecdir,
|
install_dir: mutter_installed_tests_libexecdir,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if have_native_tests
|
||||||
|
native_headless_tests = executable('mutter-native-headless-tests',
|
||||||
|
sources: [
|
||||||
|
'native-headless.c',
|
||||||
|
'test-utils.c',
|
||||||
|
'test-utils.h',
|
||||||
|
],
|
||||||
|
include_directories: tests_includepath,
|
||||||
|
c_args: tests_c_args,
|
||||||
|
dependencies: [tests_deps],
|
||||||
|
install: have_installed_tests,
|
||||||
|
install_dir: mutter_installed_tests_libexecdir,
|
||||||
|
)
|
||||||
|
endif
|
||||||
|
|
||||||
stacking_tests = [
|
stacking_tests = [
|
||||||
'basic-x11',
|
'basic-x11',
|
||||||
'basic-wayland',
|
'basic-wayland',
|
||||||
@ -223,3 +238,12 @@ test('anonymous-file', anonymous_file_test,
|
|||||||
is_parallel: false,
|
is_parallel: false,
|
||||||
timeout: 60,
|
timeout: 60,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if have_native_tests
|
||||||
|
test('native-headless', native_headless_tests,
|
||||||
|
suite: ['core', 'mutter/native/headless'],
|
||||||
|
env: test_env,
|
||||||
|
is_parallel: false,
|
||||||
|
timeout: 60,
|
||||||
|
)
|
||||||
|
endif
|
||||||
|
75
src/tests/native-headless.c
Normal file
75
src/tests/native-headless.c
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2021 Red Hat Inc.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License as
|
||||||
|
* published by the Free Software Foundation; either version 2 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||||
|
* 02111-1307, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include "backends/meta-settings-private.h"
|
||||||
|
#include "backends/native/meta-backend-native.h"
|
||||||
|
#include "compositor/meta-plugin-manager.h"
|
||||||
|
#include "core/main-private.h"
|
||||||
|
#include "meta/main.h"
|
||||||
|
#include "meta/meta-backend.h"
|
||||||
|
#include "tests/test-utils.h"
|
||||||
|
|
||||||
|
static void
|
||||||
|
init_tests (void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
run_tests (gpointer data)
|
||||||
|
{
|
||||||
|
MetaBackend *backend = meta_get_backend ();
|
||||||
|
MetaSettings *settings = meta_backend_get_settings (backend);
|
||||||
|
gboolean ret;
|
||||||
|
|
||||||
|
meta_settings_override_experimental_features (settings);
|
||||||
|
meta_settings_enable_experimental_feature (
|
||||||
|
settings,
|
||||||
|
META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER);
|
||||||
|
|
||||||
|
ret = g_test_run ();
|
||||||
|
|
||||||
|
meta_quit (ret != 0);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main (int argc,
|
||||||
|
char **argv)
|
||||||
|
{
|
||||||
|
test_init (&argc, &argv);
|
||||||
|
init_tests ();
|
||||||
|
|
||||||
|
meta_plugin_manager_load (test_get_plugin_name ());
|
||||||
|
|
||||||
|
meta_override_compositor_configuration (META_COMPOSITOR_TYPE_WAYLAND,
|
||||||
|
META_TYPE_BACKEND_NATIVE,
|
||||||
|
"headless", TRUE,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
meta_init ();
|
||||||
|
meta_register_with_session ();
|
||||||
|
|
||||||
|
g_idle_add (run_tests, NULL);
|
||||||
|
|
||||||
|
return meta_run ();
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user