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> 2004-04-05 Benjamin Otte <otte@gnome.org>
* gst/schedulers/gstbasicscheduler.c: * gst/schedulers/gstbasicscheduler.c:

View file

@ -42,13 +42,13 @@ main (gint argc, gchar * argv[])
after = gst_debug_get_all_categories (); after = gst_debug_get_all_categories ();
g_print ("removing default log function\n"); g_print ("removing default log function\n");
g_assert (gst_debug_remove_log_function (gst_debug_log_default) == #ifdef GST_DISABLE_GST_DEBUG
(GST_DISABLE_GST_DEBUG ? 0 : 1)); 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 g_print
("checking, if the two new categories are put into the category list correctly...\n"); ("checking, if the two new categories are put into the category list correctly...\n");
g_assert (g_slist_length (after) - g_slist_length (before) == g_assert (g_slist_length (after) - g_slist_length (before) == 2);
(GST_DISABLE_GST_DEBUG ? 0 : 2));
#ifndef GST_DISABLE_GST_DEBUG
/* check the _get stuff */ /* check the _get stuff */
g_print g_print
("checking, if the gst_debug_category_get_* stuff works with the categories...\n"); ("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 (cat);
GST_DEBUG_CATEGORY_STATIC (cat_static); GST_DEBUG_CATEGORY_STATIC (cat_static);
#ifndef GST_DISABLE_GST_DEBUG
static const gchar *lines[] = { static const gchar *lines[] = {
"--gst-debug-disable", "--gst-debug-disable",
"--gst-debug-no-color", "--gst-debug-no-color",
@ -34,7 +35,6 @@ static const gchar *lines[] = {
"--gst-debug-level=4 --gst-debug=cat_*:5" "--gst-debug-level=4 --gst-debug=cat_*:5"
}; };
#ifndef GST_DISABLE_GST_DEBUG
static void static void
debug_not_reached (GstDebugCategory * category, GstDebugLevel level, debug_not_reached (GstDebugCategory * category, GstDebugLevel level,
const gchar * file, const gchar * function, gint line, GObject * object, const gchar * file, const gchar * function, gint line, GObject * object,
@ -49,21 +49,24 @@ main (gint argc, gchar * argv[])
{ {
if (argc == 1) { if (argc == 1) {
/* this is the main run that calls the others */ /* this is the main run that calls the others */
gint i, runs, exit;
gchar *command;
unsetenv ("GST_DEBUG"); unsetenv ("GST_DEBUG");
gst_init (&argc, &argv); gst_init (&argc, &argv);
runs = G_N_ELEMENTS (lines);
#ifndef GST_DISABLE_GST_DEBUG #ifndef GST_DISABLE_GST_DEBUG
for (i = 0; i < runs; i++) { {
command = g_strdup_printf ("%s %s %d", argv[0], lines[i], i); gint i, runs, exit;
g_print ("running \"%s\"\n", command); gchar *command;
g_assert (g_spawn_command_line_sync (command, NULL, NULL, &exit,
NULL) == TRUE); runs = G_N_ELEMENTS (lines);
g_assert (exit == 0); for (i = 0; i < runs; i++) {
g_print ("\"%s\" worked as expected.\n", command); command = g_strdup_printf ("%s %s %d", argv[0], lines[i], i);
g_free (command); 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 #endif

View file

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

View file

@ -42,13 +42,13 @@ main (gint argc, gchar * argv[])
after = gst_debug_get_all_categories (); after = gst_debug_get_all_categories ();
g_print ("removing default log function\n"); g_print ("removing default log function\n");
g_assert (gst_debug_remove_log_function (gst_debug_log_default) == #ifdef GST_DISABLE_GST_DEBUG
(GST_DISABLE_GST_DEBUG ? 0 : 1)); 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 g_print
("checking, if the two new categories are put into the category list correctly...\n"); ("checking, if the two new categories are put into the category list correctly...\n");
g_assert (g_slist_length (after) - g_slist_length (before) == g_assert (g_slist_length (after) - g_slist_length (before) == 2);
(GST_DISABLE_GST_DEBUG ? 0 : 2));
#ifndef GST_DISABLE_GST_DEBUG
/* check the _get stuff */ /* check the _get stuff */
g_print g_print
("checking, if the gst_debug_category_get_* stuff works with the categories...\n"); ("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 (cat);
GST_DEBUG_CATEGORY_STATIC (cat_static); GST_DEBUG_CATEGORY_STATIC (cat_static);
#ifndef GST_DISABLE_GST_DEBUG
static const gchar *lines[] = { static const gchar *lines[] = {
"--gst-debug-disable", "--gst-debug-disable",
"--gst-debug-no-color", "--gst-debug-no-color",
@ -34,7 +35,6 @@ static const gchar *lines[] = {
"--gst-debug-level=4 --gst-debug=cat_*:5" "--gst-debug-level=4 --gst-debug=cat_*:5"
}; };
#ifndef GST_DISABLE_GST_DEBUG
static void static void
debug_not_reached (GstDebugCategory * category, GstDebugLevel level, debug_not_reached (GstDebugCategory * category, GstDebugLevel level,
const gchar * file, const gchar * function, gint line, GObject * object, const gchar * file, const gchar * function, gint line, GObject * object,
@ -49,21 +49,24 @@ main (gint argc, gchar * argv[])
{ {
if (argc == 1) { if (argc == 1) {
/* this is the main run that calls the others */ /* this is the main run that calls the others */
gint i, runs, exit;
gchar *command;
unsetenv ("GST_DEBUG"); unsetenv ("GST_DEBUG");
gst_init (&argc, &argv); gst_init (&argc, &argv);
runs = G_N_ELEMENTS (lines);
#ifndef GST_DISABLE_GST_DEBUG #ifndef GST_DISABLE_GST_DEBUG
for (i = 0; i < runs; i++) { {
command = g_strdup_printf ("%s %s %d", argv[0], lines[i], i); gint i, runs, exit;
g_print ("running \"%s\"\n", command); gchar *command;
g_assert (g_spawn_command_line_sync (command, NULL, NULL, &exit,
NULL) == TRUE); runs = G_N_ELEMENTS (lines);
g_assert (exit == 0); for (i = 0; i < runs; i++) {
g_print ("\"%s\" worked as expected.\n", command); command = g_strdup_printf ("%s %s %d", argv[0], lines[i], i);
g_free (command); 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 #endif

View file

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