[mutter/wip/carlosg/async-xwayland-startup: 42/45] tests: Set fatal log handler on clutter tests
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/async-xwayland-startup: 42/45] tests: Set fatal log handler on clutter tests
- Date: Fri, 28 Feb 2020 18:04:40 +0000 (UTC)
commit 2cce54c2a1079522af9e76d68488f290477e730d
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Nov 20 00:06:26 2019 +0100
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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]