1
0
Fork 0

tests: Move out KMS utils unit tests to its own executable

Better to split things up a bit, so one can with more ease run a
specific test.

In the KMS utils case, we don't even need a mutter context, making it
much lighter.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1927>
This commit is contained in:
Jonas Ådahl 2021-07-09 12:37:14 +02:00 committed by Marge Bot
parent ec390b68c5
commit 021a401bc8
4 changed files with 32 additions and 32 deletions

View file

@ -18,9 +18,8 @@
#include "config.h"
#include "tests/kms-utils-unit-tests.h"
#include <glib.h>
#include "tests/test-utils.h"
#include "backends/native/meta-kms-utils.h"
typedef struct {
@ -121,7 +120,7 @@ static const ModeInfoTestCase test_cases[] = {
};
static void
refresh_rate (void)
meta_test_kms_refresh_rate (void)
{
size_t index;
@ -138,8 +137,18 @@ refresh_rate (void)
}
}
void
static void
init_kms_utils_tests (void)
{
g_test_add_func ("/kms-utils/refresh-rate", refresh_rate);
g_test_add_func ("/backends/native/kms/refresh-rate",
meta_test_kms_refresh_rate);
}
int
main (int argc,
char **argv)
{
g_test_init (&argc, &argv, NULL);
init_kms_utils_tests ();
return g_test_run ();
}

View file

@ -1,23 +0,0 @@
/*
* Copyright (C) 2021 Akihiko Odaki <akihiko.odaki@gmail.com>
*
* 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef KMS_UTILS_UNIT_TESTS_H
#define KMS_UTILS_UNIT_TESTS_H
void init_kms_utils_tests (void);
#endif /* KMS_UTILS_UNIT_TESTS_H */

View file

@ -76,8 +76,6 @@ unit_tests = executable('mutter-test-unit-tests',
'unit-tests.c',
'boxes-tests.c',
'boxes-tests.h',
'kms-utils-unit-tests.c',
'kms-utils-unit-tests.h',
'meta-backend-test.c',
'meta-backend-test.h',
'meta-gpu-test.c',
@ -165,6 +163,17 @@ ref_test_sources = [
]
if have_native_tests
native_kms_utils_tests = executable('mutter-native-kms-utils-tests',
sources: [
'kms-utils-unit-tests.c',
],
include_directories: tests_includepath,
c_args: tests_c_args,
dependencies: [tests_deps],
install: have_installed_tests,
install_dir: mutter_installed_tests_libexecdir,
)
native_headless_tests = executable('mutter-native-headless-tests',
sources: [
'native-headless.c',
@ -296,6 +305,13 @@ test('anonymous-file', anonymous_file_test,
)
if have_native_tests
test('native-kms-utils', native_kms_utils_tests,
suite: ['core', 'mutter/native/kms'],
env: test_env,
is_parallel: false,
timeout: 60,
)
test('native-headless', native_headless_tests,
suite: ['core', 'mutter/native/headless'],
env: test_env,

View file

@ -29,7 +29,6 @@
#include "core/boxes-private.h"
#include "core/main-private.h"
#include "tests/boxes-tests.h"
#include "tests/kms-utils-unit-tests.h"
#include "tests/meta-backend-test.h"
#include "tests/monitor-config-migration-unit-tests.h"
#include "tests/monitor-unit-tests.h"
@ -251,7 +250,6 @@ init_tests (int argc, char **argv)
g_test_add_func ("/core/boxes/adjacent-to", meta_test_adjacent_to);
init_kms_utils_tests ();
init_monitor_store_tests ();
init_monitor_config_migration_tests ();
init_monitor_tests ();