[farsight2/master] tests: Use GST_DEBUG/LOG/WARNING instead of g_debug in tests

Olivier Crête olivier.crete at collabora.co.uk
Thu Jun 25 14:48:45 PDT 2009


---
 tests/check/base/fscodec.c          |    2 +-
 tests/check/rtp/codecs.c            |    8 ++++----
 tests/check/rtp/conference.c        |   31 ++++++++++++++-----------------
 tests/check/rtp/generic.c           |    2 +-
 tests/check/rtp/sendcodecs.c        |    6 +++---
 tests/check/testutils.c             |    6 ++++--
 tests/check/transmitter/generic.c   |    4 ++--
 tests/check/transmitter/multicast.c |    6 +++---
 tests/check/transmitter/nice.c      |   20 ++++++++++----------
 tests/check/transmitter/rawudp.c    |   22 ++++++++++------------
 10 files changed, 52 insertions(+), 55 deletions(-)

diff --git a/tests/check/base/fscodec.c b/tests/check/base/fscodec.c
index 0589620..26b374d 100644
--- a/tests/check/base/fscodec.c
+++ b/tests/check/base/fscodec.c
@@ -231,7 +231,7 @@ GST_START_TEST (test_fscodec_keyfile)
     GList *item;
     for(item = codecs; item ; item= item->next)
     {
-      g_debug ("%s", fs_codec_to_string (item->data));
+      GST_DEBUG ("%s", fs_codec_to_string (item->data));
     }
   }
 #endif
diff --git a/tests/check/rtp/codecs.c b/tests/check/rtp/codecs.c
index 5761143..e3a78f5 100644
--- a/tests/check/rtp/codecs.c
+++ b/tests/check/rtp/codecs.c
@@ -416,8 +416,8 @@ GST_START_TEST (test_rtpcodecs_reserved_pt)
 
   if (!item)
   {
-    g_debug ("Could not find a dynamically allocated codec, skipping testing"
-               " of the payload-type reservation mecanism");
+    GST_WARNING ("Could not find a dynamically allocated codec,"
+        " skipping testing of the payload-type reservation mecanism");
     goto out;
   }
 
@@ -759,7 +759,7 @@ run_test_rtpcodecs_config_data (gboolean preset_remotes)
 
   if (!item)
   {
-    g_debug ("Could not find Vorbis encoder/decoder/payloader/depayloaders,"
+    GST_WARNING ("Could not find Vorbis encoder/decoder/payloader/depayloaders,"
         " so we are skipping the config-data test");
     goto out;
   }
@@ -987,7 +987,7 @@ GST_START_TEST (test_rtpcodecs_dynamic_pt)
 
   if (!codec1 || !codec2)
   {
-    g_debug ("Could not find two dynamically allocated codec,"
+    GST_WARNING ("Could not find two dynamically allocated codec,"
         "skipping testing of the payload-type dynamic number preferences");
     goto out;
   }
diff --git a/tests/check/rtp/conference.c b/tests/check/rtp/conference.c
index c915917..065f78a 100644
--- a/tests/check/rtp/conference.c
+++ b/tests/check/rtp/conference.c
@@ -142,7 +142,7 @@ _new_local_candidate (FsStream *stream, FsCandidate *candidate)
   if (candidate->component_id == FS_COMPONENT_RTCP && no_rtcp)
     return;
 
-  g_debug ("%d:%d: Setting remote candidate for component %d",
+  GST_DEBUG ("%d:%d: Setting remote candidate for component %d",
       other_st->dat->id,
       other_st->target->id,
       candidate->component_id);
@@ -171,7 +171,7 @@ _current_send_codec_changed (FsSession *session, FsCodec *codec)
   gst_object_unref (conf);
 
   str = fs_codec_to_string (codec);
-  g_debug ("%d: New send codec: %s", dat->id, str);
+  GST_DEBUG ("%d: New send codec: %s", dat->id, str);
   g_free (str);
 }
 
@@ -339,7 +339,7 @@ _bus_callback (GstBus *bus, GstMessage *message, gpointer user_data)
         gchar *debug = NULL;
         gst_message_parse_warning (message, &error, &debug);
 
-        g_debug ("%d: Got a warning on the BUS (%d): %s (%s)", dat->id,
+        GST_WARNING ("%d: Got a warning on the BUS (%d): %s (%s)", dat->id,
             error->code,
             error->message, debug);
         g_error_free (error);
@@ -377,7 +377,7 @@ _handoff_handler (GstElement *element, GstBuffer *buffer, GstPad *pad,
       st->flags &= ~WAITING_ON_LAST_CODEC;
       st->flags |= SHOULD_BE_LAST_CODEC;
       max_buffer_count += st->buffer_count;
-      g_debug ("We HAVE last codec");
+      GST_DEBUG ("We HAVE last codec");
     }
     else
     {
@@ -385,7 +385,7 @@ _handoff_handler (GstElement *element, GstBuffer *buffer, GstPad *pad,
       gchar *str = fs_codec_to_string (
           g_object_get_data (G_OBJECT (element), "codec"));
       gchar *str2 = fs_codec_to_string (g_list_last (codecs)->data);
-      g_debug ("not yet the last codec, skipping (we have %s, we want %s)",
+      GST_DEBUG ("not yet the last codec, skipping (we have %s, we want %s)",
           str, str2);
       g_free (str);
       g_free (str2);
@@ -420,11 +420,8 @@ _handoff_handler (GstElement *element, GstBuffer *buffer, GstPad *pad,
 
 
   st->buffer_count++;
-  /*
-    Disabled because it outputs too much stuff
-  if (st->buffer_count % 10 == 0)
-    g_debug ("%d:%d: Buffer %d", st->dat->id, st->target->id, st->buffer_count);
-  */
+  GST_LOG ("%d:%d: Buffer %d", st->dat->id, st->target->id, st->buffer_count);
+
 
   /*
   ts_fail_if (dat->buffer_count > max_buffer_count,
@@ -465,7 +462,7 @@ _handoff_handler (GstElement *element, GstBuffer *buffer, GstPad *pad,
       ts_fail_if (g_list_length (nego_codecs) < 2, "Only one negotiated codec");
 
       str = fs_codec_to_string (g_list_last (nego_codecs)->data);
-      g_debug ("Setting codec to: %s", str);
+      GST_DEBUG ("Setting codec to: %s", str);
       g_free (str);
 
       ts_fail_unless (fs_session_set_send_codec (st->target->session,
@@ -478,7 +475,7 @@ _handoff_handler (GstElement *element, GstBuffer *buffer, GstPad *pad,
 
       st->flags |= HAS_BEEN_RESET | WAITING_ON_LAST_CODEC;
 
-      g_debug ("RESET TO LAST CODEC");
+      GST_DEBUG ("RESET TO LAST CODEC");
 
     } else {
       g_main_loop_quit (loop);
@@ -526,7 +523,7 @@ _src_pad_added (FsStream *self, GstPad *pad, FsCodec *codec, gpointer user_data)
       GST_STATE_CHANGE_FAILURE, "Could not set the fakesink to playing");
 
   str = fs_codec_to_string (codec);
-  g_debug ("%d:%d: Added Fakesink for codec %s", st->dat->id, st->target->id,
+  GST_DEBUG ("%d:%d: Added Fakesink for codec %s", st->dat->id, st->target->id,
            str);
   g_free (str);
 }
@@ -570,7 +567,7 @@ _start_pipeline (gpointer user_data)
 {
   struct SimpleTestConference *dat = user_data;
 
-  g_debug ("%d: Starting pipeline", dat->id);
+  GST_DEBUG ("%d: Starting pipeline", dat->id);
 
   ts_fail_if (gst_element_set_state (dat->pipeline, GST_STATE_PLAYING) ==
     GST_STATE_CHANGE_FAILURE, "Could not set the pipeline to playing");
@@ -606,7 +603,7 @@ _negotiated_codecs_notify (GObject *object, GParamSpec *paramspec,
   GError *error = NULL;
   GList *item = NULL;
 
-  g_debug ("%d: New negotiated codecs", dat->id);
+  GST_DEBUG ("%d: New negotiated codecs", dat->id);
 
   ts_fail_if (session != dat->session, "Got signal from the wrong object");
 
@@ -621,7 +618,7 @@ _negotiated_codecs_notify (GObject *object, GParamSpec *paramspec,
     struct SimpleTestStream *st2 = find_pointback_stream (st->target, dat);
     GList *rcodecs2;
 
-    g_debug ("Setting negotiated remote codecs on %d:%d from %d",st2->dat->id,
+    GST_DEBUG ("Setting negotiated remote codecs on %d:%d from %d",st2->dat->id,
         st2->target->id, dat->id);
     if (!fs_stream_set_remote_codecs (st2->stream, codecs, &error))
     {
@@ -682,7 +679,7 @@ set_initial_codecs (
       " you must install gst-plugins-good");
 
 
-  g_debug ("Setting initial remote codecs on %d:%d from %d",
+  GST_DEBUG ("Setting initial remote codecs on %d:%d from %d",
       to->dat->id, to->target->id,
       from->id);
 
diff --git a/tests/check/rtp/generic.c b/tests/check/rtp/generic.c
index de469c6..4009a06 100644
--- a/tests/check/rtp/generic.c
+++ b/tests/check/rtp/generic.c
@@ -126,7 +126,7 @@ setup_fakesrc (struct SimpleTestConference *dat)
 {
   GstPad *sinkpad = NULL, *srcpad = NULL;
 
-  g_debug ("Adding fakesrc");
+  GST_DEBUG ("Adding fakesrc");
 
 
   g_object_get (dat->session, "sink-pad", &sinkpad, NULL);
diff --git a/tests/check/rtp/sendcodecs.c b/tests/check/rtp/sendcodecs.c
index 37046bb..a9c88b8 100644
--- a/tests/check/rtp/sendcodecs.c
+++ b/tests/check/rtp/sendcodecs.c
@@ -46,7 +46,7 @@ _start_pipeline (gpointer user_data)
 {
   struct SimpleTestConference *dat = user_data;
 
-  g_debug ("%d: Starting pipeline", dat->id);
+  GST_DEBUG ("%d: Starting pipeline", dat->id);
 
   ts_fail_if (gst_element_set_state (dat->pipeline, GST_STATE_PLAYING) ==
     GST_STATE_CHANGE_FAILURE, "Could not set the pipeline to playing");
@@ -134,7 +134,7 @@ _bus_callback (GstBus *bus, GstMessage *message, gpointer user_data)
         gchar *debug = NULL;
         gst_message_parse_warning (message, &error, &debug);
 
-        g_debug ("%d: Got a warning on the BUS (%d): %s (%s)", dat->id,
+        GST_WARNING ("%d: Got a warning on the BUS (%d): %s (%s)", dat->id,
             error->code,
             error->message, debug);
         g_error_free (error);
@@ -277,7 +277,7 @@ one_way (GCallback havedata_handler, gpointer data)
 
   recv_pipeline = build_recv_pipeline (havedata_handler, NULL, &port);
 
-  g_debug ("port is %d", port);
+  GST_DEBUG ("port is %d", port);
 
   candidates = g_list_prepend (NULL,
       fs_candidate_new ("1", FS_COMPONENT_RTP, FS_CANDIDATE_TYPE_HOST,
diff --git a/tests/check/testutils.c b/tests/check/testutils.c
index 8fa4e18..c41cc62 100644
--- a/tests/check/testutils.c
+++ b/tests/check/testutils.c
@@ -22,6 +22,8 @@
 # include <config.h>
 #endif
 
+#include <gst/check/gstcheck.h>
+
 #include "testutils.h"
 
 #ifdef HAVE_GETIFADDRS
@@ -56,13 +58,13 @@ find_multicast_capable_address (void)
     {
       g_free (retval);
       retval = NULL;
-      g_debug ("Disabling test, more than one multicast capable interface");
+      GST_DEBUG ("Disabling test, more than one multicast capable interface");
       break;
     }
 
     retval = g_strdup (
         inet_ntoa (((struct sockaddr_in *) ifa->ifa_addr)->sin_addr));
-    g_debug ("Sending from %s on interface %s", retval, ifa->ifa_name);
+    GST_DEBUG ("Sending from %s on interface %s", retval, ifa->ifa_name);
   }
 
   freeifaddrs (results);
diff --git a/tests/check/transmitter/generic.c b/tests/check/transmitter/generic.c
index c8ff8fb..effafe5 100644
--- a/tests/check/transmitter/generic.c
+++ b/tests/check/transmitter/generic.c
@@ -160,7 +160,7 @@ bus_error_callback (GstBus *bus, GstMessage *message, gpointer user_data)
         gchar *debug = NULL;
         gst_message_parse_warning (message, &error, &debug);
 
-        g_debug ("Got a warning on the BUS (%d): %s (%s)",
+        GST_WARNING ("Got a warning on the BUS (%d): %s (%s)",
             error->code,
             error->message, debug);
         g_error_free (error);
@@ -222,7 +222,7 @@ setup_stund (void)
           G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
           NULL, NULL, &stund_pid, &error))
   {
-    g_debug ("Could not spawn stund, skipping stun testing: %s",
+    GST_WARNING ("Could not spawn stund, skipping stun testing: %s",
         error->message);
     g_clear_error (&error);
     return;
diff --git a/tests/check/transmitter/multicast.c b/tests/check/transmitter/multicast.c
index 0a284f2..c44af8f 100644
--- a/tests/check/transmitter/multicast.c
+++ b/tests/check/transmitter/multicast.c
@@ -64,7 +64,7 @@ _handoff_handler (GstElement *element, GstBuffer *buffer, GstPad *pad,
   buffer_count[component_id-1]++;
 
   /*
-  g_debug ("Buffer %d component: %d size: %u", buffer_count[component_id-1],
+  GST_DEBUG ("Buffer %d component: %d size: %u", buffer_count[component_id-1],
     component_id, GST_BUFFER_SIZE (buffer));
   */
 
@@ -88,7 +88,7 @@ _new_active_candidate_pair (FsStreamTransmitter *st, FsCandidate *local,
   ts_fail_unless (local->component_id == remote->component_id,
     "Local and remote candidates dont have the same component id");
 
-  g_debug ("New active candidate pair for component %d", local->component_id);
+  GST_DEBUG ("New active candidate pair for component %d", local->component_id);
 
   if (!src_setup[local->component_id-1])
     setup_fakesrc (user_data, pipeline, local->component_id);
@@ -100,7 +100,7 @@ _start_pipeline (gpointer user_data)
 {
   GstElement *pipeline = user_data;
 
-  g_debug ("Starting pipeline");
+  GST_DEBUG ("Starting pipeline");
 
   ts_fail_if (gst_element_set_state (pipeline, GST_STATE_PLAYING) ==
     GST_STATE_CHANGE_FAILURE, "Could not set the pipeline to playing");
diff --git a/tests/check/transmitter/nice.c b/tests/check/transmitter/nice.c
index 40db926..d34b459 100644
--- a/tests/check/transmitter/nice.c
+++ b/tests/check/transmitter/nice.c
@@ -62,7 +62,7 @@ static void
 _new_local_candidate (FsStreamTransmitter *st, FsCandidate *candidate,
   gpointer user_data)
 {
-  g_debug ("Has local candidate %s:%u of type %d",
+  GST_DEBUG ("Has local candidate %s:%u of type %d",
     candidate->ip, candidate->port, candidate->type);
 
   ts_fail_if (candidate == NULL, "Passed NULL candidate");
@@ -86,9 +86,9 @@ _new_local_candidate (FsStreamTransmitter *st, FsCandidate *candidate,
   ts_fail_if (candidate->username == NULL, "Candidate doenst have a username");
   ts_fail_if (candidate->password == NULL, "Candidate doenst have a password");
 
-  g_debug ("New local candidate %s:%d of type %d for component %d",
+  GST_DEBUG ("New local candidate %s:%d of type %d for component %d",
     candidate->ip, candidate->port, candidate->type, candidate->component_id);
-  g_debug ("username: %s password: %s", candidate->username,
+  GST_DEBUG ("username: %s password: %s", candidate->username,
       candidate->password);
 
   if (is_address_local)
@@ -163,7 +163,7 @@ _local_candidates_prepared (FsStreamTransmitter *st, gpointer user_data)
   ts_fail_if (g_list_length (candidates) < 2,
       "We don't have at least 2 candidates");
 
-  g_debug ("Local Candidates Prepared");
+  GST_DEBUG ("Local Candidates Prepared");
 
   g_object_set_data (G_OBJECT (st2), "candidates-set", candidates);
 
@@ -181,7 +181,7 @@ _new_active_candidate_pair (FsStreamTransmitter *st, FsCandidate *local,
   ts_fail_unless (local->component_id == remote->component_id,
     "Local and remote candidates dont have the same component id");
 
-  g_debug ("New active candidate pair");
+  GST_DEBUG ("New active candidate pair");
 }
 
 static void
@@ -199,10 +199,10 @@ _handoff_handler (GstElement *element, GstBuffer *buffer, GstPad *pad,
 
   if (buffer_count[stream][component_id-1] % 10 == 0)
   {
-    g_debug ("Buffer %d stream: %u component: %d size: %u",
+    GST_DEBUG ("Buffer %d stream: %u component: %d size: %u",
         buffer_count[stream][component_id-1], stream,
         component_id, GST_BUFFER_SIZE (buffer));
-    g_debug ("Received %d %d %d %d",
+    GST_DEBUG ("Received %d %d %d %d",
         buffer_count[0][0], buffer_count[0][1],
         buffer_count[1][0], buffer_count[1][1]);
   }
@@ -289,7 +289,7 @@ _stream_state_changed (FsStreamTransmitter *st, guint component,
   enumclass = g_type_class_ref (FS_TYPE_STREAM_STATE);
   enumvalue = g_enum_get_value (enumclass, state);
 
-  g_debug ("%p: Stream state for component %u is now %s (%u)", st,
+  GST_DEBUG ("%p: Stream state for component %u is now %s (%u)", st,
       component, enumvalue->value_nick, state);
 
   ts_fail_if (state == FS_STREAM_STATE_FAILED,
@@ -322,12 +322,12 @@ _stream_state_changed (FsStreamTransmitter *st, guint component,
   {
     GstElement *pipeline = GST_ELEMENT (
         g_object_get_data (G_OBJECT (trans), "pipeline"));
-    g_debug ("%p: Setting up fakesrc for component %u", st, component);
+    GST_DEBUG ("%p: Setting up fakesrc for component %u", st, component);
     setup_fakesrc (trans, pipeline, component);
     g_object_set_data (G_OBJECT (trans), prop, "");
   }
   else
-    g_debug ("FAKESRC ALREADY SETUP for component %u", component);
+    GST_DEBUG ("FAKESRC ALREADY SETUP for component %u", component);
 }
 
 
diff --git a/tests/check/transmitter/rawudp.c b/tests/check/transmitter/rawudp.c
index 9ac79a1..b503247 100644
--- a/tests/check/transmitter/rawudp.c
+++ b/tests/check/transmitter/rawudp.c
@@ -98,7 +98,7 @@ _new_local_candidate (FsStreamTransmitter *st, FsCandidate *candidate,
   GList *item = NULL;
   gboolean ret;
 
-  g_debug ("Has local candidate %s:%u of type %d",
+  GST_DEBUG ("Has local candidate %s:%u of type %d",
     candidate->ip, candidate->port, candidate->type);
 
   ts_fail_if (candidate == NULL, "Passed NULL candidate");
@@ -137,7 +137,7 @@ _new_local_candidate (FsStreamTransmitter *st, FsCandidate *candidate,
 
   candidates[candidate->component_id-1] = 1;
 
-  g_debug ("New local candidate %s:%d of type %d for component %d",
+  GST_DEBUG ("New local candidate %s:%d of type %d for component %d",
     candidate->ip, candidate->port, candidate->type, candidate->component_id);
 
   item = g_list_prepend (NULL, candidate);
@@ -160,7 +160,7 @@ _local_candidates_prepared (FsStreamTransmitter *st, gpointer user_data)
   ts_fail_if (candidates[0] == 0, "candidates-prepared with no RTP candidate");
   ts_fail_if (candidates[1] == 0, "candidates-prepared with no RTCP candidate");
 
-  g_debug ("Local Candidates Prepared");
+  GST_DEBUG ("Local Candidates Prepared");
 
   /*
    * This doesn't work on my router
@@ -184,7 +184,7 @@ _new_active_candidate_pair (FsStreamTransmitter *st, FsCandidate *local,
   ts_fail_unless (local->component_id == remote->component_id,
     "Local and remote candidates dont have the same component id");
 
-  g_debug ("New active candidate pair for component %d", local->component_id);
+  GST_DEBUG ("New active candidate pair for component %d", local->component_id);
 
   g_static_mutex_lock (&pipeline_mod_mutex);
   if (!pipeline_done && !src_setup[local->component_id-1])
@@ -205,10 +205,8 @@ _handoff_handler (GstElement *element, GstBuffer *buffer, GstPad *pad,
 
   buffer_count[component_id-1]++;
 
-  /*
-  g_debug ("Buffer %d component: %d size: %u", buffer_count[component_id-1],
+  GST_LOG ("Buffer %d component: %d size: %u", buffer_count[component_id-1],
     component_id, GST_BUFFER_SIZE (buffer));
-  */
 
   ts_fail_if (buffer_count[component_id-1] > 20,
     "Too many buffers %d > 20 for component",
@@ -332,7 +330,7 @@ run_rawudp_transmitter_test (gint n_parameters, GParameter *params,
         error->code == FS_ERROR_NETWORK &&
         error->message && strstr (error->message, "unreachable"))
     {
-      g_debug ("Skipping stunserver test, we have no network");
+      GST_WARNING ("Skipping stunserver test, we have no network");
       goto skip;
     }
     else
@@ -548,12 +546,12 @@ _bus_stop_stream_cb (GstBus *bus, GstMessage *message, gpointer user_data)
   if (pending != GST_STATE_VOID_PENDING)
     ts_fail ("New state playing, but pending is %d", pending);
 
-  g_debug ("Stopping stream transmitter");
+  GST_DEBUG ("Stopping stream transmitter");
 
   fs_stream_transmitter_stop (st);
   g_object_unref (st);
 
-  g_debug ("Stopped stream transmitter");
+  GST_DEBUG ("Stopped stream transmitter");
 
   g_atomic_int_set(&running, FALSE);
   g_main_loop_quit (loop);
@@ -884,7 +882,7 @@ setup_stunalternd_valid (void)
       "127.0.0.1", 3478, 3480);
 
   if (!stun_alternd_data)
-    g_debug ("Could not spawn stunalternd,"
+    GST_WARNING ("Could not spawn stunalternd,"
         " skipping stun alternate server testing");
 }
 
@@ -895,7 +893,7 @@ setup_stunalternd_loop (void)
       "127.0.0.1", 3478, 3478);
 
   if (!stun_alternd_data)
-    g_debug ("Could not spawn stunalternd,"
+    GST_WARNING ("Could not spawn stunalternd,"
         " skipping stun alternate server testing");
 }
 
-- 
1.5.6.5



More information about the farsight-commits mailing list