testsuite/debug/: fix tests to work again with debugging enabled

Original commit message from CVS:
* testsuite/debug/category.c: (main):
* testsuite/debug/commandline.c: (main):
* testsuite/debug/output.c: (main):
fix tests to work again with debugging enabled
This commit is contained in:
Benjamin Otte 2004-04-05 04:31:00 +00:00
parent 03c19b3e3e
commit e25612f443
7 changed files with 61 additions and 46 deletions

View file

@ -1,3 +1,10 @@
2004-04-05 Benjamin Otte <otte@gnome.org>
* testsuite/debug/category.c: (main):
* testsuite/debug/commandline.c: (main):
* testsuite/debug/output.c: (main):
fix tests to work again with debugging enabled
2004-04-05 Benjamin Otte <otte@gnome.org>
* gst/schedulers/gstbasicscheduler.c:

View file

@ -42,13 +42,13 @@ main (gint argc, gchar * argv[])
after = gst_debug_get_all_categories ();
g_print ("removing default log function\n");
g_assert (gst_debug_remove_log_function (gst_debug_log_default) ==
(GST_DISABLE_GST_DEBUG ? 0 : 1));
#ifdef GST_DISABLE_GST_DEBUG
g_assert (gst_debug_remove_log_function (gst_debug_log_default) == 0);
#else
g_assert (gst_debug_remove_log_function (gst_debug_log_default) == 1);
g_print
("checking, if the two new categories are put into the category list correctly...\n");
g_assert (g_slist_length (after) - g_slist_length (before) ==
(GST_DISABLE_GST_DEBUG ? 0 : 2));
#ifndef GST_DISABLE_GST_DEBUG
g_assert (g_slist_length (after) - g_slist_length (before) == 2);
/* check the _get stuff */
g_print
("checking, if the gst_debug_category_get_* stuff works with the categories...\n");

View file

@ -26,6 +26,7 @@
GST_DEBUG_CATEGORY (cat);
GST_DEBUG_CATEGORY_STATIC (cat_static);
#ifndef GST_DISABLE_GST_DEBUG
static const gchar *lines[] = {
"--gst-debug-disable",
"--gst-debug-no-color",
@ -34,7 +35,6 @@ static const gchar *lines[] = {
"--gst-debug-level=4 --gst-debug=cat_*:5"
};
#ifndef GST_DISABLE_GST_DEBUG
static void
debug_not_reached (GstDebugCategory * category, GstDebugLevel level,
const gchar * file, const gchar * function, gint line, GObject * object,
@ -49,21 +49,24 @@ main (gint argc, gchar * argv[])
{
if (argc == 1) {
/* this is the main run that calls the others */
gint i, runs, exit;
gchar *command;
unsetenv ("GST_DEBUG");
gst_init (&argc, &argv);
runs = G_N_ELEMENTS (lines);
#ifndef GST_DISABLE_GST_DEBUG
for (i = 0; i < runs; i++) {
command = g_strdup_printf ("%s %s %d", argv[0], lines[i], i);
g_print ("running \"%s\"\n", command);
g_assert (g_spawn_command_line_sync (command, NULL, NULL, &exit,
NULL) == TRUE);
g_assert (exit == 0);
g_print ("\"%s\" worked as expected.\n", command);
g_free (command);
{
gint i, runs, exit;
gchar *command;
runs = G_N_ELEMENTS (lines);
for (i = 0; i < runs; i++) {
command = g_strdup_printf ("%s %s %d", argv[0], lines[i], i);
g_print ("running \"%s\"\n", command);
g_assert (g_spawn_command_line_sync (command, NULL, NULL, &exit,
NULL) == TRUE);
g_assert (exit == 0);
g_print ("\"%s\" worked as expected.\n", command);
g_free (command);
}
}
#endif

View file

@ -65,10 +65,10 @@ main (gint argc, gchar * argv[])
"default category for this test");
GST_DEBUG_CATEGORY_INIT (cat2, "GST_Check_2", 0,
"second category for this test");
g_assert (gst_debug_remove_log_function (gst_debug_log_default) !=
GST_DISABLE_GST_DEBUG);
g_assert (gst_debug_add_log_function (check_message,
NULL) != GST_DISABLE_GST_DEBUG);
#ifndef GST_DISABLE_GST_DEBUG
g_assert (gst_debug_remove_log_function (gst_debug_log_default) == 1);
#endif
gst_debug_add_log_function (check_message, NULL);
count = 0;
GST_ERROR ("This is an error.");
@ -119,8 +119,9 @@ main (gint argc, gchar * argv[])
"This is a log message with category and object.");
count = -1;
g_assert (gst_debug_remove_log_function (check_message) ==
(GST_DISABLE_GST_DEBUG ? 0 : 1));
#ifndef GST_DISABLE_GST_DEBUG
g_assert (gst_debug_remove_log_function (check_message) == 1);
#endif
return 0;
}

View file

@ -42,13 +42,13 @@ main (gint argc, gchar * argv[])
after = gst_debug_get_all_categories ();
g_print ("removing default log function\n");
g_assert (gst_debug_remove_log_function (gst_debug_log_default) ==
(GST_DISABLE_GST_DEBUG ? 0 : 1));
#ifdef GST_DISABLE_GST_DEBUG
g_assert (gst_debug_remove_log_function (gst_debug_log_default) == 0);
#else
g_assert (gst_debug_remove_log_function (gst_debug_log_default) == 1);
g_print
("checking, if the two new categories are put into the category list correctly...\n");
g_assert (g_slist_length (after) - g_slist_length (before) ==
(GST_DISABLE_GST_DEBUG ? 0 : 2));
#ifndef GST_DISABLE_GST_DEBUG
g_assert (g_slist_length (after) - g_slist_length (before) == 2);
/* check the _get stuff */
g_print
("checking, if the gst_debug_category_get_* stuff works with the categories...\n");

View file

@ -26,6 +26,7 @@
GST_DEBUG_CATEGORY (cat);
GST_DEBUG_CATEGORY_STATIC (cat_static);
#ifndef GST_DISABLE_GST_DEBUG
static const gchar *lines[] = {
"--gst-debug-disable",
"--gst-debug-no-color",
@ -34,7 +35,6 @@ static const gchar *lines[] = {
"--gst-debug-level=4 --gst-debug=cat_*:5"
};
#ifndef GST_DISABLE_GST_DEBUG
static void
debug_not_reached (GstDebugCategory * category, GstDebugLevel level,
const gchar * file, const gchar * function, gint line, GObject * object,
@ -49,21 +49,24 @@ main (gint argc, gchar * argv[])
{
if (argc == 1) {
/* this is the main run that calls the others */
gint i, runs, exit;
gchar *command;
unsetenv ("GST_DEBUG");
gst_init (&argc, &argv);
runs = G_N_ELEMENTS (lines);
#ifndef GST_DISABLE_GST_DEBUG
for (i = 0; i < runs; i++) {
command = g_strdup_printf ("%s %s %d", argv[0], lines[i], i);
g_print ("running \"%s\"\n", command);
g_assert (g_spawn_command_line_sync (command, NULL, NULL, &exit,
NULL) == TRUE);
g_assert (exit == 0);
g_print ("\"%s\" worked as expected.\n", command);
g_free (command);
{
gint i, runs, exit;
gchar *command;
runs = G_N_ELEMENTS (lines);
for (i = 0; i < runs; i++) {
command = g_strdup_printf ("%s %s %d", argv[0], lines[i], i);
g_print ("running \"%s\"\n", command);
g_assert (g_spawn_command_line_sync (command, NULL, NULL, &exit,
NULL) == TRUE);
g_assert (exit == 0);
g_print ("\"%s\" worked as expected.\n", command);
g_free (command);
}
}
#endif

View file

@ -65,10 +65,10 @@ main (gint argc, gchar * argv[])
"default category for this test");
GST_DEBUG_CATEGORY_INIT (cat2, "GST_Check_2", 0,
"second category for this test");
g_assert (gst_debug_remove_log_function (gst_debug_log_default) !=
GST_DISABLE_GST_DEBUG);
g_assert (gst_debug_add_log_function (check_message,
NULL) != GST_DISABLE_GST_DEBUG);
#ifndef GST_DISABLE_GST_DEBUG
g_assert (gst_debug_remove_log_function (gst_debug_log_default) == 1);
#endif
gst_debug_add_log_function (check_message, NULL);
count = 0;
GST_ERROR ("This is an error.");
@ -119,8 +119,9 @@ main (gint argc, gchar * argv[])
"This is a log message with category and object.");
count = -1;
g_assert (gst_debug_remove_log_function (check_message) ==
(GST_DISABLE_GST_DEBUG ? 0 : 1));
#ifndef GST_DISABLE_GST_DEBUG
g_assert (gst_debug_remove_log_function (check_message) == 1);
#endif
return 0;
}