[folks] Factor Tp logger warning out of Tp tests.



commit 9a539691a07feb1dcb7197b1acceb4fcef7582de
Author: Travis Reitter <travis reitter collabora co uk>
Date:   Mon Jan 10 16:50:27 2011 -0800

    Factor Tp logger warning out of Tp tests.
    
    Helps bgo#639195 - Print stack traces for failed tests to improve
    remote debugging

 tests/lib/telepathy/contactlist/backend.c       |   14 ++++++++++++++
 tests/telepathy/individual-properties.vala      |   21 ---------------------
 tests/telepathy/individual-retrieval.vala       |   14 --------------
 tests/telepathy/persona-store-capabilities.vala |    7 -------
 4 files changed, 14 insertions(+), 42 deletions(-)
---
diff --git a/tests/lib/telepathy/contactlist/backend.c b/tests/lib/telepathy/contactlist/backend.c
index 62311b1..a84fda0 100644
--- a/tests/lib/telepathy/contactlist/backend.c
+++ b/tests/lib/telepathy/contactlist/backend.c
@@ -118,6 +118,17 @@ tp_test_backend_new (void)
   return g_object_new (TP_TEST_TYPE_BACKEND, NULL);
 }
 
+static gboolean
+_log_fatal_handler (const char *domain,
+   GLogLevelFlags flags,
+   const char *message,
+   gpointer user_data)
+{
+  return !g_str_has_suffix (message,
+      "The name org.freedesktop.Telepathy.Logger was not provided by any "
+      ".service files");
+}
+
 void
 tp_test_backend_set_up (TpTestBackend *self)
 {
@@ -127,6 +138,9 @@ tp_test_backend_set_up (TpTestBackend *self)
   gchar *object_path;
   GError *error = NULL;
 
+  /* Ignore the error caused by not running the logger */
+  g_test_log_set_fatal_handler (_log_fatal_handler, NULL);
+
   priv->daemon = tp_dbus_daemon_dup (&error);
   if (error != NULL)
     g_error ("Couldn't get D-Bus daemon: %s", error->message);
diff --git a/tests/telepathy/individual-properties.vala b/tests/telepathy/individual-properties.vala
index 578aac8..296e16c 100644
--- a/tests/telepathy/individual-properties.vala
+++ b/tests/telepathy/individual-properties.vala
@@ -38,13 +38,6 @@ public class IndividualPropertiesTests : Folks.TestCase
     {
       var main_loop = new GLib.MainLoop (null, false);
 
-      /* Ignore the error caused by not running the logger */
-      Test.log_set_fatal_handler ((d, l, m) =>
-        {
-          return !m.has_suffix ("The name org.freedesktop.Telepathy.Logger " +
-              "was not provided by any .service files");
-        });
-
       /* Set up the aggregator */
       var aggregator = new IndividualAggregator ();
       aggregator.individuals_changed.connect ((added, removed, m, a, r) =>
@@ -93,13 +86,6 @@ public class IndividualPropertiesTests : Folks.TestCase
       var main_loop = new GLib.MainLoop (null, false);
       var alias_notified = false;
 
-      /* Ignore the error caused by not running the logger */
-      Test.log_set_fatal_handler ((d, l, m) =>
-        {
-          return !m.has_suffix ("The name org.freedesktop.Telepathy.Logger " +
-              "was not provided by any .service files");
-        });
-
       /* Set up the aggregator */
       var aggregator = new IndividualAggregator ();
       aggregator.individuals_changed.connect ((added, removed, m, a, r) =>
@@ -163,13 +149,6 @@ public class IndividualPropertiesTests : Folks.TestCase
       var main_loop = new GLib.MainLoop (null, false);
       var alias_notified = false;
 
-      /* Ignore the error caused by not running the logger */
-      Test.log_set_fatal_handler ((d, l, m) =>
-        {
-          return !m.has_suffix ("The name org.freedesktop.Telepathy.Logger " +
-              "was not provided by any .service files");
-        });
-
       /* Set up the aggregator */
       var aggregator = new IndividualAggregator ();
       aggregator.individuals_changed.connect ((added, removed, m, a, r) =>
diff --git a/tests/telepathy/individual-retrieval.vala b/tests/telepathy/individual-retrieval.vala
index 438019c..8851384 100644
--- a/tests/telepathy/individual-retrieval.vala
+++ b/tests/telepathy/individual-retrieval.vala
@@ -48,13 +48,6 @@ public class IndividualRetrievalTests : Folks.TestCase
     {
       var main_loop = new GLib.MainLoop (null, false);
 
-      /* Ignore the error caused by not running the logger */
-      Test.log_set_fatal_handler ((d, l, m) =>
-        {
-          return !m.has_suffix ("The name org.freedesktop.Telepathy.Logger " +
-              "was not provided by any .service files");
-        });
-
       /* work on a copy so we can mangle it */
       HashSet<string> expected_individuals = new HashSet<string> ();
       foreach (var id in this.default_individuals)
@@ -111,13 +104,6 @@ public class IndividualRetrievalTests : Folks.TestCase
     {
       var main_loop = new GLib.MainLoop (null, false);
 
-      /* Ignore the error caused by not running the logger */
-      Test.log_set_fatal_handler ((d, l, m) =>
-        {
-          return !m.has_suffix ("The name org.freedesktop.Telepathy.Logger " +
-              "was not provided by any .service files");
-        });
-
       HashSet<string> added_individuals = new HashSet<string> ();
       added_individuals.add ("master shake example com");
       added_individuals.add ("2wycked example com");
diff --git a/tests/telepathy/persona-store-capabilities.vala b/tests/telepathy/persona-store-capabilities.vala
index 94060c8..f031f26 100644
--- a/tests/telepathy/persona-store-capabilities.vala
+++ b/tests/telepathy/persona-store-capabilities.vala
@@ -36,13 +36,6 @@ public class PersonaStoreCapabilitiesTests : Folks.TestCase
     {
       var main_loop = new GLib.MainLoop (null, false);
 
-      /* Ignore the error caused by not running the logger */
-      Test.log_set_fatal_handler ((d, l, m) =>
-        {
-          return !m.has_suffix ("The name org.freedesktop.Telepathy.Logger " +
-              "was not provided by any .service files");
-        });
-
       var backend_store = BackendStore.dup ();
       backend_store.backend_available.connect ((b) =>
           {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]