From 7e6a713a88ab6f513f3e6ffd76b9fd26d1745a86 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Fri, 15 Jun 2012 16:58:03 -0400 Subject: gsttest: Add arguments to manage GStreamer debug logging level We need 2 arguments for that as we will want in some case to manage the log level on a non global basis (which would happen when we need more detail about a particular failure, in which case we would raise the level) but have a default that would is global to all iterations of start/stop --- lib/insanity-gst/insanitygsttest.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/lib/insanity-gst/insanitygsttest.c b/lib/insanity-gst/insanitygsttest.c index 76edf8f..c3976b6 100644 --- a/lib/insanity-gst/insanitygsttest.c +++ b/lib/insanity-gst/insanitygsttest.c @@ -61,10 +61,13 @@ static gboolean insanity_gst_test_setup (InsanityTest * test) { const char *registry; + gchar *loglevel; if (!INSANITY_TEST_CLASS (insanity_gst_test_parent_class)->setup (test)) return FALSE; + insanity_test_get_string_argument (test, "global-gst-debug-level", &loglevel); + g_setenv ("GST_DEBUG", loglevel, TRUE); /* Set GST_REGISTRY to the target filename */ registry = insanity_test_get_output_filename (test, "gst-registry"); @@ -86,6 +89,17 @@ insanity_gst_test_setup (InsanityTest * test) static gboolean insanity_gst_test_start (InsanityTest * test) { + gchar *loglevel; + + insanity_test_get_string_argument (test, "gst-debug-level", &loglevel); + if (g_strcmp0 (loglevel, "-1") != 0) + g_setenv ("GST_DEBUG", loglevel, TRUE); + else { + insanity_test_get_string_argument (test, "global-gst-debug-level", + &loglevel); + g_setenv ("GST_DEBUG", loglevel, TRUE); + } + if (!INSANITY_TEST_CLASS (insanity_gst_test_parent_class)->start (test)) return FALSE; @@ -115,6 +129,17 @@ insanity_gst_test_init (InsanityGstTest * gsttest) gsttest->priv = priv; + /* Add our argument */ + insanity_test_add_string_argument (test, "global-gst-debug-level", + "Default GStreamer debug level to be used for the test", + "This argument is used when no debug log level has been specified" + " between the various iteration of start/stop", TRUE, "0"); + insanity_test_add_string_argument (test, "gst-debug-level", + "The GStreamer debug level to be used for the test", + "This argument is used when you need more control over the debug logs" + " and want to set it between iterations of start/stop ('-1' means that" + " 'global-gst-debug-level' should be used instead)", FALSE, "-1"); + /* Add our own items, etc */ insanity_test_add_output_file (test, "gst-registry", "The GStreamer registry file", TRUE); -- cgit v1.2.3