summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThibault Saunier <thibault.saunier@collabora.com>2012-06-15 16:58:03 -0400
committerThibault Saunier <thibault.saunier@collabora.com>2012-06-19 12:23:59 -0400
commit7e6a713a88ab6f513f3e6ffd76b9fd26d1745a86 (patch)
tree1d9c05b774a917413538bbe4ddacb2672889c7c0
parentddfcd50b7e92b57aa796ae860d92d6fa459a505a (diff)
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
-rw-r--r--lib/insanity-gst/insanitygsttest.c25
1 files changed, 25 insertions, 0 deletions
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);