[mutter/wip/3v1n0/run-tests-in-ci: 1/14] tests: Accept warnings when initializing mutter
- From: Marco Trevisan <marcotrevi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/3v1n0/run-tests-in-ci: 1/14] tests: Accept warnings when initializing mutter
- Date: Wed, 14 Nov 2018 08:19:59 +0000 (UTC)
commit 4334534742b6224ef44a138b39ef90467c7d8e19
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date: Tue Nov 13 18:44:24 2018 -0600
tests: Accept warnings when initializing mutter
Initializing mutter, might cause warning such as the `failed to bind to` when
another XServer is running. However these warnings are not critical, so we can
safely ignore them.
src/tests/headless-start-test.c | 3 +--
src/tests/test-runner.c | 3 +--
src/tests/test-utils.c | 16 ++++++++++++++++
src/tests/test-utils.h | 2 ++
src/tests/unit-tests.c | 3 +--
5 files changed, 21 insertions(+), 6 deletions(-)
---
diff --git a/src/tests/headless-start-test.c b/src/tests/headless-start-test.c
index 18fecbb96..1a0e84ac4 100644
--- a/src/tests/headless-start-test.c
+++ b/src/tests/headless-start-test.c
@@ -191,8 +191,7 @@ main (int argc, char *argv[])
META_TYPE_BACKEND_TEST);
meta_wayland_override_display_name ("mutter-test-display");
- meta_init ();
- meta_register_with_session ();
+ test_meta_init ();
g_idle_add (run_tests, NULL);
diff --git a/src/tests/test-runner.c b/src/tests/test-runner.c
index 343865952..84a06ba88 100644
--- a/src/tests/test-runner.c
+++ b/src/tests/test-runner.c
@@ -799,8 +799,7 @@ main (int argc, char **argv)
meta_plugin_manager_load (test_get_plugin_name ());
meta_wayland_override_display_name ("mutter-test-display");
- meta_init ();
- meta_register_with_session ();
+ test_meta_init ();
RunTestsInfo info;
info.tests = (char **)tests->pdata;
diff --git a/src/tests/test-utils.c b/src/tests/test-utils.c
index ceac34e9d..7a1b11341 100644
--- a/src/tests/test-utils.c
+++ b/src/tests/test-utils.c
@@ -22,6 +22,7 @@
#include "tests/test-utils.h"
#include <gio/gio.h>
+#include <meta/main.h>
#include <string.h>
#include "core/display-private.h"
@@ -94,6 +95,21 @@ test_init (int *argc,
ensure_test_client_path (*argc, *argv);
}
+void
+test_meta_init ()
+{
+ GLogLevelFlags log_flags;
+
+ /* Accept warnings in mutter initialization, as `failed to bind` one */
+ log_flags = g_log_set_always_fatal (G_LOG_FATAL_MASK);
+ g_log_set_always_fatal (log_flags & ~G_LOG_LEVEL_WARNING);
+
+ meta_init ();
+ meta_register_with_session ();
+
+ g_log_set_always_fatal (log_flags);
+}
+
AsyncWaiter *
async_waiter_new (void)
{
diff --git a/src/tests/test-utils.h b/src/tests/test-utils.h
index 5dfec8367..c72e00880 100644
--- a/src/tests/test-utils.h
+++ b/src/tests/test-utils.h
@@ -43,6 +43,8 @@ typedef struct _TestClient TestClient;
void test_init (int *argc,
char ***argv);
+void test_meta_init (void);
+
gboolean async_waiter_alarm_filter (AsyncWaiter *waiter,
MetaX11Display *x11_display,
XSyncAlarmNotifyEvent *event);
diff --git a/src/tests/unit-tests.c b/src/tests/unit-tests.c
index 50ec89dc5..703881532 100644
--- a/src/tests/unit-tests.c
+++ b/src/tests/unit-tests.c
@@ -265,8 +265,7 @@ main (int argc, char *argv[])
META_TYPE_BACKEND_TEST);
meta_wayland_override_display_name ("mutter-test-display");
- meta_init ();
- meta_register_with_session ();
+ test_meta_init ();
g_idle_add (run_tests, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]