From 8c332a4704a9cff68d0aa32504bfee5d90901e51 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Wed, 20 Nov 2019 00:06:26 +0100 Subject: [PATCH] tests: Set fatal log handler on clutter tests With Xwayland initialization going async, these errors will seep into the parts controlled by g_test*(), resulting in the harmless errors about DBus names not acquired turned fatal. Set an error log handler, and specifically ignore those. https://gitlab.gnome.org/GNOME/mutter/merge_requests/944 --- src/tests/clutter-test-utils.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/tests/clutter-test-utils.c b/src/tests/clutter-test-utils.c index baf14c604..59db1021a 100644 --- a/src/tests/clutter-test-utils.c +++ b/src/tests/clutter-test-utils.c @@ -12,6 +12,22 @@ typedef struct { static ClutterTestEnvironment *test_environ = NULL; +#define DBUS_NAME_WARNING "Lost or failed to acquire name" + +static gboolean +log_func (const gchar *log_domain, + GLogLevelFlags log_level, + const gchar *message, + gpointer user_data) +{ + if ((log_level & G_LOG_LEVEL_WARNING) && + g_strcmp0 (log_domain, "mutter") == 0 && + g_str_has_prefix (message, DBUS_NAME_WARNING)) + return FALSE; + + return TRUE; +} + /* * clutter_test_init: * @argc: (inout): number of arguments in @argv @@ -107,6 +123,8 @@ clutter_test_func_wrapper (gconstpointer data_) { const ClutterTestData *data = data_; + g_test_log_set_fatal_handler (log_func, NULL); + /* ensure that the previous test state has been cleaned up */ g_assert_null (test_environ->stage);