summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2019-11-20 00:06:26 +0100
committerJonas Ã…dahl <jadahl@gmail.com>2020-02-28 20:20:35 +0000
commit8c332a4704a9cff68d0aa32504bfee5d90901e51 (patch)
treee1383cd56bb0339bfd265c5591487a96dcf12ecf
parent21994bb00df3fc06cf83d021c3c65f313745db70 (diff)
downloadmutter-8c332a4704a9cff68d0aa32504bfee5d90901e51.tar.gz
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
-rw-r--r--src/tests/clutter-test-utils.c18
1 files changed, 18 insertions, 0 deletions
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);