[mutter] tests: Move out KMS utils unit tests to its own executable



commit 021a401bc85352b0aa7f52661f7b91693a72672b
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Fri Jul 9 12:37:14 2021 +0200

    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>

 src/tests/kms-utils-unit-tests.c | 19 ++++++++++++++-----
 src/tests/kms-utils-unit-tests.h | 23 -----------------------
 src/tests/meson.build            | 20 ++++++++++++++++++--
 src/tests/unit-tests.c           |  2 --
 4 files changed, 32 insertions(+), 32 deletions(-)
---
diff --git a/src/tests/kms-utils-unit-tests.c b/src/tests/kms-utils-unit-tests.c
index 743d46e0eb..ae5bb5c818 100644
--- a/src/tests/kms-utils-unit-tests.c
+++ b/src/tests/kms-utils-unit-tests.c
@@ -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 ();
 }
diff --git a/src/tests/meson.build b/src/tests/meson.build
index 2a2e357822..d21669503f 100644
--- a/src/tests/meson.build
+++ b/src/tests/meson.build
@@ -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,
diff --git a/src/tests/unit-tests.c b/src/tests/unit-tests.c
index 308a2f278d..880956f340 100644
--- a/src/tests/unit-tests.c
+++ b/src/tests/unit-tests.c
@@ -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 ();


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