[next] telepathy-glib: Logger tests: enable all debug with tpl_debug_set_flags(), tp_debug_set_flags()

Simon McVittie smcv at kemper.freedesktop.org
Wed Mar 19 13:00:51 PDT 2014


Module: telepathy-glib
Branch: next
Commit: 8f97a840f1d9c303e60d416c385f7a4419423aba
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=8f97a840f1d9c303e60d416c385f7a4419423aba

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Tue Mar 18 17:27:21 2014 +0000

Logger tests: enable all debug with tpl_debug_set_flags(), tp_debug_set_flags()

Stop using tp_debug_divert_messages(), which is redundant with
recent Automake's logging support, and
_tpl_debug_set_flags_from_env(), which requires setting special
environment variables.

Reviewed-by: Xavier Claessens

---

 tests/logger/dbus/test-entity.c               |    6 ++++++
 tests/logger/dbus/test-log-manager.c          |    8 ++++----
 tests/logger/dbus/test-tpl-log-iter-pidgin.c  |    8 ++++----
 tests/logger/dbus/test-tpl-log-iter-xml.c     |    8 ++++----
 tests/logger/dbus/test-tpl-log-store-pidgin.c |    8 ++++----
 tests/logger/dbus/test-tpl-log-store-sqlite.c |    7 +++++--
 tests/logger/dbus/test-tpl-log-store-xml.c    |    8 ++++----
 tests/logger/dbus/test-tpl-log-walker.c       |    8 ++++----
 tests/logger/dbus/test-tpl-observer.c         |    5 +++++
 tests/logger/test-tpl-conf.c                  |    6 ++++++
 10 files changed, 46 insertions(+), 26 deletions(-)

diff --git a/tests/logger/dbus/test-entity.c b/tests/logger/dbus/test-entity.c
index ab9c9a2..7df50b5 100644
--- a/tests/logger/dbus/test-entity.c
+++ b/tests/logger/dbus/test-entity.c
@@ -2,6 +2,9 @@
 
 #include <glib.h>
 #include <glib/gprintf.h>
+#include <telepathy-glib/telepathy-glib.h>
+
+#include <telepathy-logger/debug.h>
 #include <telepathy-logger/entity.h>
 #include <telepathy-logger/entity-internal.h>
 
@@ -154,6 +157,9 @@ test_entity_instantiation_from_tp_contact (void)
 int main (int argc,
     char **argv)
 {
+  tpl_debug_set_flags ("all");
+  tp_debug_set_flags ("all");
+
   tp_tests_init (&argc, &argv);
 
   g_test_add_func ("/entity/instantiation",
diff --git a/tests/logger/dbus/test-log-manager.c b/tests/logger/dbus/test-log-manager.c
index 5986e9e..0534e69 100644
--- a/tests/logger/dbus/test-log-manager.c
+++ b/tests/logger/dbus/test-log-manager.c
@@ -7,6 +7,7 @@
 #include "lib/simple-account-manager.h"
 #include "lib/logger-test-helper.h"
 
+#include <telepathy-logger/debug.h>
 #include "telepathy-logger/debug-internal.h"
 #include "telepathy-logger/log-manager-internal.h"
 #include "telepathy-logger/log-store-internal.h"
@@ -260,10 +261,6 @@ setup_for_writing (TestCaseFixture *fixture,
 static void
 setup_debug (void)
 {
-  tp_debug_divert_messages (g_getenv ("TPL_LOGFILE"));
-
-  _tpl_debug_set_flags_from_env ();
-
   stamp_logs = (g_getenv ("TPL_TIMING") != NULL);
   debug_sender = tp_debug_sender_dup ();
 
@@ -748,6 +745,9 @@ main (int argc, char **argv)
   int retval;
   GTestDBus *test_dbus;
 
+  tpl_debug_set_flags ("all");
+  tp_debug_set_flags ("all");
+
   /* FIXME: this stuff should be part of the fixture, but setup_debug()
    * uses tp_dbus_daemon_dup() */
   g_test_dbus_unset ();
diff --git a/tests/logger/dbus/test-tpl-log-iter-pidgin.c b/tests/logger/dbus/test-tpl-log-iter-pidgin.c
index 9d8cf72..358da08 100644
--- a/tests/logger/dbus/test-tpl-log-iter-pidgin.c
+++ b/tests/logger/dbus/test-tpl-log-iter-pidgin.c
@@ -3,6 +3,7 @@
 #include "lib/simple-account.h"
 #include "lib/util.h"
 
+#include <telepathy-logger/debug.h>
 #include "telepathy-logger/debug-internal.h"
 #include "telepathy-logger/log-iter-internal.h"
 #include "telepathy-logger/log-iter-pidgin-internal.h"
@@ -52,6 +53,9 @@ setup (PidginTestCaseFixture* fixture,
   GHashTable *asv;
   const gchar *account_path = NULL;
 
+  tpl_debug_set_flags ("all");
+  tp_debug_set_flags ("all");
+
   fixture->main_loop = g_main_loop_new (NULL, FALSE);
   g_assert (fixture->main_loop != NULL);
 
@@ -106,10 +110,6 @@ setup (PidginTestCaseFixture* fixture,
   g_array_free (features, FALSE);
 
   g_main_loop_run (fixture->main_loop);
-
-  tp_debug_divert_messages (g_getenv ("TPL_LOGFILE"));
-
-  _tpl_debug_set_flags_from_env ();
 }
 
 
diff --git a/tests/logger/dbus/test-tpl-log-iter-xml.c b/tests/logger/dbus/test-tpl-log-iter-xml.c
index 1204fc1..88a3edb 100644
--- a/tests/logger/dbus/test-tpl-log-iter-xml.c
+++ b/tests/logger/dbus/test-tpl-log-iter-xml.c
@@ -4,6 +4,7 @@
 #include "lib/util.h"
 
 #include "telepathy-logger/call-event.h"
+#include <telepathy-logger/debug.h>
 #include "telepathy-logger/debug-internal.h"
 #include "telepathy-logger/log-iter-internal.h"
 #include "telepathy-logger/log-iter-xml-internal.h"
@@ -34,6 +35,9 @@ setup (XmlTestCaseFixture* fixture,
 {
   GError *error = NULL;
 
+  tpl_debug_set_flags ("all");
+  tp_debug_set_flags ("all");
+
   fixture->main_loop = g_main_loop_new (NULL, FALSE);
 
   fixture->store = g_object_new (TPL_TYPE_LOG_STORE_XML,
@@ -55,10 +59,6 @@ setup (XmlTestCaseFixture* fixture,
   tpl_test_create_and_prepare_account (fixture->bus, fixture->factory,
       TP_ACCOUNT_OBJECT_PATH_BASE "gabble/jabber/user_40collabora_2eco_2euk",
       &fixture->account, &fixture->account_service);
-
-  tp_debug_divert_messages (g_getenv ("TPL_LOGFILE"));
-
-  _tpl_debug_set_flags_from_env ();
 }
 
 
diff --git a/tests/logger/dbus/test-tpl-log-store-pidgin.c b/tests/logger/dbus/test-tpl-log-store-pidgin.c
index 147ecb2..be7a523 100644
--- a/tests/logger/dbus/test-tpl-log-store-pidgin.c
+++ b/tests/logger/dbus/test-tpl-log-store-pidgin.c
@@ -9,6 +9,7 @@
 #include "lib/simple-account.h"
 #include "lib/simple-account-manager.h"
 
+#include <telepathy-logger/debug.h>
 #include <telepathy-logger/log-store-pidgin-internal.h>
 #include <telepathy-logger/text-event-internal.h>
 #include <telepathy-logger/client-factory-internal.h>
@@ -169,6 +170,9 @@ static void
 setup (PidginTestCaseFixture* fixture,
     gconstpointer user_data)
 {
+  tpl_debug_set_flags ("all");
+  tp_debug_set_flags ("all");
+
   DEBUG ("setting up");
 
   fixture->main_loop = g_main_loop_new (NULL, FALSE);
@@ -521,10 +525,6 @@ test_get_events_for_empty_file (PidginTestCaseFixture *fixture,
 static void
 setup_debug (void)
 {
-  tp_debug_divert_messages (g_getenv ("TPL_LOGFILE"));
-
-  _tpl_debug_set_flags_from_env ();
-
   stamp_logs = (g_getenv ("TPL_TIMING") != NULL);
   debug_sender = tp_debug_sender_dup ();
 
diff --git a/tests/logger/dbus/test-tpl-log-store-sqlite.c b/tests/logger/dbus/test-tpl-log-store-sqlite.c
index 5d26168..5d8a4bf 100644
--- a/tests/logger/dbus/test-tpl-log-store-sqlite.c
+++ b/tests/logger/dbus/test-tpl-log-store-sqlite.c
@@ -1,5 +1,8 @@
 #include "config.h"
 
+#include <telepathy-glib/telepathy-glib.h>
+
+#include <telepathy-logger/debug.h>
 #include <telepathy-logger/log-store-sqlite-internal.h>
 #include <telepathy-logger/debug-internal.h>
 #include <telepathy-logger/client-factory-internal.h>
@@ -14,6 +17,8 @@ static void
 setup (Fixture *fixture,
     gconstpointer data)
 {
+  tpl_debug_set_flags ("all");
+  tp_debug_set_flags ("all");
 }
 
 static void
@@ -26,8 +31,6 @@ test (Fixture *fixture,
   GError *error = NULL;
   TpClientFactory* factory;
 
-  _tpl_debug_set_flags_from_env ();
-
   bus = tp_dbus_daemon_dup (&error);
   g_assert_no_error (error);
 
diff --git a/tests/logger/dbus/test-tpl-log-store-xml.c b/tests/logger/dbus/test-tpl-log-store-xml.c
index 3dcd89e..1bd1e95 100644
--- a/tests/logger/dbus/test-tpl-log-store-xml.c
+++ b/tests/logger/dbus/test-tpl-log-store-xml.c
@@ -5,6 +5,7 @@
 #include "lib/logger-test-helper.h"
 #include "lib/util.h"
 
+#include <telepathy-logger/debug.h>
 #include "telepathy-logger/debug-internal.h"
 #include "telepathy-logger/log-manager-internal.h"
 #include "telepathy-logger/log-store-internal.h"
@@ -35,6 +36,9 @@ setup (XmlTestCaseFixture* fixture,
 {
   GError *error = NULL;
 
+  tpl_debug_set_flags ("all");
+  tp_debug_set_flags ("all");
+
   fixture->main_loop = g_main_loop_new (NULL, FALSE);
 
   fixture->store = g_object_new (TPL_TYPE_LOG_STORE_XML,
@@ -57,10 +61,6 @@ setup (XmlTestCaseFixture* fixture,
   fixture->factory = _tpl_client_factory_dup (fixture->bus);
 
   fixture->account_manager = tp_account_manager_dup ();
-
-  tp_debug_divert_messages (g_getenv ("TPL_LOGFILE"));
-
-  _tpl_debug_set_flags_from_env ();
 }
 
 
diff --git a/tests/logger/dbus/test-tpl-log-walker.c b/tests/logger/dbus/test-tpl-log-walker.c
index 6035ff7..cba3f03 100644
--- a/tests/logger/dbus/test-tpl-log-walker.c
+++ b/tests/logger/dbus/test-tpl-log-walker.c
@@ -6,6 +6,7 @@
 #include "lib/util.h"
 
 #include "telepathy-logger/call-event.h"
+#include <telepathy-logger/debug.h>
 #include "telepathy-logger/debug-internal.h"
 #include "telepathy-logger/log-manager.h"
 #include "telepathy-logger/text-event.h"
@@ -54,6 +55,9 @@ setup (WalkerTestCaseFixture* fixture,
   GHashTable *asv;
   const gchar *account_path = NULL;
 
+  tpl_debug_set_flags ("all");
+  tp_debug_set_flags ("all");
+
   fixture->main_loop = g_main_loop_new (NULL, FALSE);
   g_assert (fixture->main_loop != NULL);
 
@@ -106,10 +110,6 @@ setup (WalkerTestCaseFixture* fixture,
   g_array_free (features, FALSE);
 
   g_main_loop_run (fixture->main_loop);
-
-  tp_debug_divert_messages (g_getenv ("TPL_LOGFILE"));
-
-  _tpl_debug_set_flags_from_env ();
 }
 
 
diff --git a/tests/logger/dbus/test-tpl-observer.c b/tests/logger/dbus/test-tpl-observer.c
index 0ecf052..0e55c8d 100644
--- a/tests/logger/dbus/test-tpl-observer.c
+++ b/tests/logger/dbus/test-tpl-observer.c
@@ -1,5 +1,8 @@
 #include "config.h"
 
+#include <telepathy-glib/telepathy-glib.h>
+
+#include <telepathy-logger/debug.h>
 #include <telepathy-logger/observer-internal.h>
 
 #include "tests/lib/util.h"
@@ -12,6 +15,8 @@ static void
 setup (Fixture *fixture,
     gconstpointer data)
 {
+  tpl_debug_set_flags ("all");
+  tp_debug_set_flags ("all");
 }
 
 static void
diff --git a/tests/logger/test-tpl-conf.c b/tests/logger/test-tpl-conf.c
index 371de4d..cd7c8d3 100644
--- a/tests/logger/test-tpl-conf.c
+++ b/tests/logger/test-tpl-conf.c
@@ -1,12 +1,18 @@
 #include "config.h"
 
+#include <telepathy-glib/telepathy-glib.h>
+
 #include <telepathy-logger/conf-internal.h>
+#include <telepathy-logger/debug.h>
 
 int
 main (int argc, char **argv)
 {
   TplConf *conf, *conf2;
 
+  tpl_debug_set_flags ("all");
+  tp_debug_set_flags ("all");
+
   conf = _tpl_conf_dup ();
 
   /* TplConf is a singleton, be sure both point to the same memory */



More information about the telepathy-commits mailing list