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.
This commit is contained in:
Marco Trevisan (Treviño) 2018-11-13 18:44:24 -06:00
parent 9a12befd22
commit 4334534742
5 changed files with 21 additions and 6 deletions

View File

@ -191,8 +191,7 @@ main (int argc, char *argv[])
META_TYPE_BACKEND_TEST); META_TYPE_BACKEND_TEST);
meta_wayland_override_display_name ("mutter-test-display"); meta_wayland_override_display_name ("mutter-test-display");
meta_init (); test_meta_init ();
meta_register_with_session ();
g_idle_add (run_tests, NULL); g_idle_add (run_tests, NULL);

View File

@ -799,8 +799,7 @@ main (int argc, char **argv)
meta_plugin_manager_load (test_get_plugin_name ()); meta_plugin_manager_load (test_get_plugin_name ());
meta_wayland_override_display_name ("mutter-test-display"); meta_wayland_override_display_name ("mutter-test-display");
meta_init (); test_meta_init ();
meta_register_with_session ();
RunTestsInfo info; RunTestsInfo info;
info.tests = (char **)tests->pdata; info.tests = (char **)tests->pdata;

View File

@ -22,6 +22,7 @@
#include "tests/test-utils.h" #include "tests/test-utils.h"
#include <gio/gio.h> #include <gio/gio.h>
#include <meta/main.h>
#include <string.h> #include <string.h>
#include "core/display-private.h" #include "core/display-private.h"
@ -94,6 +95,21 @@ test_init (int *argc,
ensure_test_client_path (*argc, *argv); 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 * AsyncWaiter *
async_waiter_new (void) async_waiter_new (void)
{ {

View File

@ -43,6 +43,8 @@ typedef struct _TestClient TestClient;
void test_init (int *argc, void test_init (int *argc,
char ***argv); char ***argv);
void test_meta_init (void);
gboolean async_waiter_alarm_filter (AsyncWaiter *waiter, gboolean async_waiter_alarm_filter (AsyncWaiter *waiter,
MetaX11Display *x11_display, MetaX11Display *x11_display,
XSyncAlarmNotifyEvent *event); XSyncAlarmNotifyEvent *event);

View File

@ -265,8 +265,7 @@ main (int argc, char *argv[])
META_TYPE_BACKEND_TEST); META_TYPE_BACKEND_TEST);
meta_wayland_override_display_name ("mutter-test-display"); meta_wayland_override_display_name ("mutter-test-display");
meta_init (); test_meta_init ();
meta_register_with_session ();
g_idle_add (run_tests, NULL); g_idle_add (run_tests, NULL);