[evolution-data-server/openismus-work] Added EDS_TESTING env var to silence messages
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/openismus-work] Added EDS_TESTING env var to silence messages
- Date: Wed, 27 Feb 2013 15:53:04 +0000 (UTC)
commit e7fa1caa26fb99be77308e6265a8f59bf0f1dda7
Author: Tristan Van Berkom <tristanvb openismus com>
Date: Thu Feb 28 00:20:39 2013 +0900
Added EDS_TESTING env var to silence messages
This commit avoids initializing GTK+ in a 'make check' environment,
as well as avoiding printing of any non-critical messages from
the services running in a 'make check' environment.
Conflicts:
services/evolution-addressbook-factory/evolution-addressbook-factory.c
services/evolution-calendar-factory/evolution-calendar-factory.c
services/evolution-source-registry/evolution-source-registry.c
libebackend/e-dbus-server.c | 17 +++++++++++++++++
.../evolution-addressbook-factory.c | 9 ++++++---
.../evolution-calendar-factory.c | 9 ++++++---
.../evolution-source-registry.c | 9 ++++++---
tests/test-server-utils/e-test-server-utils.c | 4 ++++
5 files changed, 39 insertions(+), 9 deletions(-)
---
diff --git a/libebackend/e-dbus-server.c b/libebackend/e-dbus-server.c
index 7015c85..3ab0e1d 100644
--- a/libebackend/e-dbus-server.c
+++ b/libebackend/e-dbus-server.c
@@ -240,6 +240,20 @@ dbus_server_quit_server (EDBusServer *server,
}
static void
+ignore_log (const gchar *log_domain,
+ GLogLevelFlags log_level,
+ const gchar *message,
+ gpointer user_data)
+{
+ /* Avoid printing of trivial messages while running test cases, only print warnings/criticals and
errors */
+ if ((log_level & (G_LOG_FLAG_FATAL |
+ G_LOG_LEVEL_ERROR |
+ G_LOG_LEVEL_CRITICAL |
+ G_LOG_LEVEL_WARNING)) != 0)
+ g_log_default_handler (log_domain, log_level, message, user_data);
+}
+
+static void
e_dbus_server_class_init (EDBusServerClass *class)
{
GObjectClass *object_class;
@@ -341,6 +355,9 @@ e_dbus_server_class_init (EDBusServerClass *class)
NULL, NULL, NULL,
G_TYPE_NONE, 1,
E_TYPE_DBUS_SERVER_EXIT_CODE);
+
+ if (g_getenv ("EDS_TESTING") != NULL)
+ g_log_set_default_handler (ignore_log, NULL);
}
static void
diff --git a/services/evolution-addressbook-factory/evolution-addressbook-factory.c
b/services/evolution-addressbook-factory/evolution-addressbook-factory.c
index 037deaa..ff59ed4 100644
--- a/services/evolution-addressbook-factory/evolution-addressbook-factory.c
+++ b/services/evolution-addressbook-factory/evolution-addressbook-factory.c
@@ -93,9 +93,12 @@ main (gint argc,
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
#if defined(ENABLE_MAINTAINER_MODE) && defined(HAVE_EDATASERVERUI)
- /* This is only to load gtk-modules, like
- * bug-buddy's gnomesegvhandler, if possible */
- gtk_init_check (&argc, &argv);
+ if (g_getenv ("EDS_TESTING") == NULL)
+ /* This is only to load gtk-modules, like
+ * bug-buddy's gnomesegvhandler, if possible */
+ gtk_init_check (&argc, &argv);
+ else
+ g_type_init ();
#else
g_type_init ();
#endif
diff --git a/services/evolution-calendar-factory/evolution-calendar-factory.c
b/services/evolution-calendar-factory/evolution-calendar-factory.c
index 4d3a9a3..dc5e4f6 100644
--- a/services/evolution-calendar-factory/evolution-calendar-factory.c
+++ b/services/evolution-calendar-factory/evolution-calendar-factory.c
@@ -97,9 +97,12 @@ main (gint argc,
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
#if defined(ENABLE_MAINTAINER_MODE) && defined(HAVE_EDATASERVERUI)
- /* This is only to load gtk-modules, like
- * bug-buddy's gnomesegvhandler, if possible. */
- gtk_init_check (&argc, &argv);
+ if (g_getenv ("EDS_TESTING") == NULL)
+ /* This is only to load gtk-modules, like
+ * bug-buddy's gnomesegvhandler, if possible */
+ gtk_init_check (&argc, &argv);
+ else
+ g_type_init ();
#else
g_type_init ();
#endif
diff --git a/services/evolution-source-registry/evolution-source-registry.c
b/services/evolution-source-registry/evolution-source-registry.c
index 6fb936b..0c273c8 100644
--- a/services/evolution-source-registry/evolution-source-registry.c
+++ b/services/evolution-source-registry/evolution-source-registry.c
@@ -44,9 +44,12 @@ main (gint argc,
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
#if defined(ENABLE_MAINTAINER_MODE) && defined(HAVE_EDATASERVERUI)
- /* This is only to load gtk-modules, like
- * bug-buddy's gnomesegvhandler, if possible */
- gtk_init_check (&argc, &argv);
+ if (g_getenv ("EDS_TESTING") == NULL)
+ /* This is only to load gtk-modules, like
+ * bug-buddy's gnomesegvhandler, if possible */
+ gtk_init_check (&argc, &argv);
+ else
+ g_type_init ();
#else
g_type_init ();
#endif
diff --git a/tests/test-server-utils/e-test-server-utils.c b/tests/test-server-utils/e-test-server-utils.c
index 6eb6dc2..8c1a10d 100644
--- a/tests/test-server-utils/e-test-server-utils.c
+++ b/tests/test-server-utils/e-test-server-utils.c
@@ -79,6 +79,10 @@ setup_environment (void)
g_assert (g_setenv ("EDS_REGISTRY_MODULES", EDS_TEST_REGISTRY_DIR, TRUE));
g_assert (g_setenv ("EDS_CAMEL_PROVIDER_DIR", EDS_TEST_CAMEL_DIR, TRUE));
g_assert (g_setenv ("GIO_USE_VFS", "local", TRUE));
+ g_assert (g_setenv ("EDS_TESTING", "1", TRUE));
+ g_assert (g_setenv ("GSETTINGS_BACKEND", "memory", TRUE));
+
+ g_unsetenv ("DISPLAY");
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]