Commit 45dae4b5 authored by Simon McVittie's avatar Simon McVittie

tests: replace most g_print() with g_printerr()

I searched all files that mention g_test_run, and replaced most
g_print() calls. This avoids interfering with TAP. Exceptions:

* gio/tests/network-monitor: a manual mode that is run by
  "./network-monitor --watch" is unaffected
* glib/gtester.c: not a test
* glib/gtestutils.c: not a test
* glib/tests/logging.c: specifically exercising g_print()
* glib/tests/markup-parse.c: a manual mode that is run by
  "./markup-parse --cdata-as-text" is unaffected
* glib/tests/testing.c: specifically exercising capture of stdout
  in subprocesses
* glib/tests/utils.c: captures a subprocess's stdout
* glib/tests/testglib.c: exercises an assertion failure in g_print()

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=725981Reviewed-by: Colin Walters's avatarColin Walters <walters@verbum.org>
Signed-off-by: Simon McVittie's avatarSimon McVittie <simon.mcvittie@collabora.co.uk>
parent 064183a6
......@@ -153,7 +153,7 @@ test_type (gconstpointer data)
}
if (g_test_verbose ())
g_print ("Property %s.%s\n", g_type_name (pspec->owner_type), pspec->name);
g_printerr ("Property %s.%s\n", g_type_name (pspec->owner_type), pspec->name);
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
g_object_get_property (instance, pspec->name, &value);
check_property ("Property", pspec, &value);
......
......@@ -290,7 +290,7 @@ resolve_arg (const gboolean is_uri_only, const char *arg)
/* Test if we get URI string */
uri = g_file_get_uri (file1);
g_assert_cmpstr (uri, !=, NULL);
g_print ("%s\n",uri);
g_printerr ("%s\n",uri);
/* Test if we get correct value of the local path */
path = g_file_get_path (file1);
......@@ -371,7 +371,7 @@ get_relative_path (const gboolean use_uri, const gboolean should_have_prefix, co
g_assert (file2 != NULL);
has_prefix = g_file_has_prefix (file2, file1);
g_print ("%s %s\n", dir1, dir2);
g_printerr ("%s %s\n", dir1, dir2);
g_assert (has_prefix == should_have_prefix);
relative_path = g_file_get_relative_path (file1, file2);
......
......@@ -49,7 +49,7 @@ _log (const gchar *format, ...)
now_tm = localtime (&now_time);
strftime (time_buf, sizeof time_buf, "%H:%M:%S", now_tm);
g_print ("%s.%06d: %s\n",
g_printerr ("%s.%06d: %s\n",
time_buf, (gint) now.tv_usec / 1000,
str);
g_free (str);
......
......@@ -1458,13 +1458,13 @@ check_interfaces (GDBusConnection *c,
#if 0
if (g_strv_length ((gchar**)interfaces) != i - 1)
{
g_print ("expected ");
g_printerr ("expected ");
for (i = 0; interfaces[i]; i++)
g_print ("%s ", interfaces[i]);
g_print ("\ngot ");
g_printerr ("%s ", interfaces[i]);
g_printerr ("\ngot ");
for (i = 0; node_info->interfaces[i]; i++)
g_print ("%s ", node_info->interfaces[i]->name);
g_print ("\n");
g_printerr ("%s ", node_info->interfaces[i]->name);
g_printerr ("\n");
}
#endif
g_assert_cmpint (g_strv_length ((gchar**)interfaces), ==, i - 1);
......
......@@ -298,7 +298,7 @@ on_new_connection (GDBusServer *server,
GError *error;
guint reg_id;
//g_print ("Client connected.\n"
//g_printerr ("Client connected.\n"
// "Negotiated capabilities: unix-fd-passing=%d\n",
// g_dbus_connection_get_capabilities (connection) & G_DBUS_CAPABILITY_FLAGS_UNIX_FD_PASSING);
......@@ -1535,7 +1535,7 @@ codegen_on_new_connection (GDBusServer *server,
ExampleAnimal *animal = user_data;
GError *error = NULL;
/* g_print ("Client connected.\n" */
/* g_printerr ("Client connected.\n" */
/* "Negotiated capabilities: unix-fd-passing=%d\n", */
/* g_dbus_connection_get_capabilities (connection) & G_DBUS_CAPABILITY_FLAGS_UNIX_FD_PASSING); */
......
......@@ -72,7 +72,7 @@ run_proxy_thread (gpointer data)
GVariant *ret;
if (g_test_verbose ())
g_print (".");
g_printerr (".");
proxy = g_dbus_proxy_new_sync (connection,
G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START |
......@@ -233,7 +233,7 @@ test_proxy (void)
* for all the oustanding method calls to complete...
*/
if (g_test_verbose ())
g_print ("\n");
g_printerr ("\n");
}
int
......
......@@ -1572,7 +1572,7 @@ om_on_signal (GDBusConnection *connection,
{
default:
case 0:
g_print ("failing and om_data->state=%d on signal %s, params=%s\n",
g_printerr ("failing and om_data->state=%d on signal %s, params=%s\n",
om_data->state,
signal_name,
g_variant_print (parameters, TRUE));
......
......@@ -296,7 +296,7 @@ test_sleep_in_thread_func (gpointer _data)
data);
g_main_loop_run (data->thread_loop);
if (g_test_verbose ())
g_print ("A");
g_printerr ("A");
//g_debug ("done invoking async (%p)", g_thread_self ());
}
else
......@@ -314,7 +314,7 @@ test_sleep_in_thread_func (gpointer _data)
NULL,
&error);
if (g_test_verbose ())
g_print ("S");
g_printerr ("S");
//g_debug ("done invoking sync (%p)", g_thread_self ());
g_assert_no_error (error);
g_assert (result != NULL);
......@@ -409,7 +409,7 @@ test_method_calls_on_proxy (GDBusProxy *proxy)
g_assert_cmpint (elapsed_msec, <, 8000);
if (g_test_verbose ())
g_print (" ");
g_printerr (" ");
}
}
......@@ -447,7 +447,7 @@ test_method_calls_in_thread (void)
g_object_unref (connection);
if (g_test_verbose ())
g_print ("\n");
g_printerr ("\n");
}
#define SLEEP_MIN_USEC 1
......@@ -532,7 +532,7 @@ test_threaded_singleton (void)
g_error ("connection had too many refs");
if (g_test_verbose () && (i % (n/50)) == 0)
g_print ("%u%%\n", ((i * 100) / n));
g_printerr ("%u%%\n", ((i * 100) / n));
/* Delay for a random time on each side of the race, to perturb the
* timing. Ideally, we want each side to win half the races; these
......@@ -574,7 +574,7 @@ test_threaded_singleton (void)
}
if (g_test_verbose ())
g_print ("Unref won %u races; Get won %u races\n", unref_wins, get_wins);
g_printerr ("Unref won %u races; Get won %u races\n", unref_wins, get_wins);
}
/* ---------------------------------------------------------------------------------------------------- */
......
......@@ -116,15 +116,15 @@ static gboolean verbose;
static gboolean posix_compat;
#ifdef G_HAVE_ISO_VARARGS
#define log(...) if (verbose) g_print (__VA_ARGS__)
#define log(...) if (verbose) g_printerr (__VA_ARGS__)
#elif defined(G_HAVE_GNUC_VARARGS)
#define log(msg...) if (verbose) g_print (msg)
#define log(msg...) if (verbose) g_printerr (msg)
#else /* no varargs macros */
static void log (const g_char *format, ...)
{
va_list args;
va_start (args, format);
if (verbose) g_print (format, args);
if (verbose) g_printerr (format, args);
va_end (args);
}
#endif
......@@ -1295,7 +1295,7 @@ main (int argc, char *argv[])
g_option_context_add_main_entries (context, cmd_entries, NULL);
if (!g_option_context_parse (context, &argc, &argv, &error))
{
g_print ("option parsing failed: %s\n", error->message);
g_printerr ("option parsing failed: %s\n", error->message);
return g_test_run ();
}
......@@ -1305,8 +1305,8 @@ main (int argc, char *argv[])
if (! target_path)
{
g_print ("error: target path was not specified\n");
g_print ("%s", g_option_context_get_help (context, TRUE, NULL));
g_printerr ("error: target path was not specified\n");
g_printerr ("%s", g_option_context_get_help (context, TRUE, NULL));
return g_test_run ();
}
......
......@@ -76,7 +76,7 @@ acquire (int nr,
: g_bit_trylock (&locks[nr], bits[nr])))
{
if (g_test_verbose ())
g_print ("thread %p going to block on lock %d\n", self, nr);
g_printerr ("thread %p going to block on lock %d\n", self, nr);
if (use_pointers)
g_pointer_bit_lock (&ptrs[nr], bits[nr]);
......
......@@ -253,7 +253,7 @@ decode_and_compare (const gchar *datap,
data2 = g_base64_decode (datap, &len);
g_assert_cmpint (len, ==, p->length);
/* g_print ("length: got %d, expected %d\n",len, length); */
/* g_printerr ("length: got %d, expected %d\n",len, length); */
memcmp_decode = memcmp (p->data, data2, p->length);
g_assert_cmpint (memcmp_decode, ==, 0);
g_free (data2);
......@@ -271,7 +271,7 @@ decode_inplace_and_compare (const gchar *datap,
data = g_strdup (datap);
data2 = g_base64_decode_inplace (data, &len);
g_assert_cmpint (len, ==, p->length);
/* g_print ("length: got %d, expected %d\n",len, length); */
/* g_printerr ("length: got %d, expected %d\n",len, length); */
memcmp_decode = memcmp (p->data, data2, p->length);
g_assert_cmpint (memcmp_decode, ==, 0);
g_free (data2);
......
......@@ -278,7 +278,7 @@ test_load (GBookmarkFile *bookmark,
res = g_bookmark_file_load_from_file (bookmark, filename, &error);
if (error && g_test_verbose ())
g_print ("Load error: %s\n", error->message);
g_printerr ("Load error: %s\n", error->message);
g_clear_error (&error);
return res;
......@@ -333,7 +333,7 @@ test_modify (GBookmarkFile *bookmark)
gchar *mime;
if (g_test_verbose ())
g_print ("\t=> check global title/description...");
g_printerr ("\t=> check global title/description...");
g_bookmark_file_set_title (bookmark, NULL, "a file");
g_bookmark_file_set_description (bookmark, NULL, "a bookmark file");
......@@ -347,10 +347,10 @@ test_modify (GBookmarkFile *bookmark)
g_assert_cmpstr (text, ==, "a bookmark file");
g_free (text);
if (g_test_verbose ())
g_print ("ok\n");
g_printerr ("ok\n");
if (g_test_verbose ())
g_print ("\t=> check bookmark title/description...");
g_printerr ("\t=> check bookmark title/description...");
g_bookmark_file_set_title (bookmark, TEST_URI_0, "a title");
g_bookmark_file_set_description (bookmark, TEST_URI_0, "a description");
g_bookmark_file_set_is_private (bookmark, TEST_URI_0, TRUE);
......@@ -386,10 +386,10 @@ test_modify (GBookmarkFile *bookmark)
g_free (icon);
g_free (mime);
if (g_test_verbose ())
g_print ("ok\n");
g_printerr ("ok\n");
if (g_test_verbose ())
g_print ("\t=> check non existing bookmark...");
g_printerr ("\t=> check non existing bookmark...");
g_bookmark_file_get_description (bookmark, TEST_URI_1, &error);
g_assert_error (error, G_BOOKMARK_FILE_ERROR, G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND);
g_clear_error (&error);
......@@ -406,10 +406,10 @@ test_modify (GBookmarkFile *bookmark)
g_assert_error (error, G_BOOKMARK_FILE_ERROR, G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND);
g_clear_error (&error);
if (g_test_verbose ())
g_print ("ok\n");
g_printerr ("ok\n");
if (g_test_verbose ())
g_print ("\t=> check application...");
g_printerr ("\t=> check application...");
g_bookmark_file_set_mime_type (bookmark, TEST_URI_0, TEST_MIME);
g_assert (!g_bookmark_file_has_application (bookmark, TEST_URI_0, TEST_APP_NAME, NULL));
g_bookmark_file_add_application (bookmark, TEST_URI_0,
......@@ -443,10 +443,10 @@ test_modify (GBookmarkFile *bookmark)
g_clear_error (&error);
if (g_test_verbose ())
g_print ("ok\n");
g_printerr ("ok\n");
if (g_test_verbose ())
g_print ("\t=> check groups...");
g_printerr ("\t=> check groups...");
g_assert (!g_bookmark_file_has_group (bookmark, TEST_URI_1, "Test", NULL));
g_bookmark_file_add_group (bookmark, TEST_URI_1, "Test");
g_assert (g_bookmark_file_has_group (bookmark, TEST_URI_1, "Test", NULL));
......@@ -468,17 +468,17 @@ test_modify (GBookmarkFile *bookmark)
g_assert_no_error (error);
if (g_test_verbose ())
g_print ("ok\n");
g_printerr ("ok\n");
if (g_test_verbose ())
g_print ("\t=> check remove...");
g_printerr ("\t=> check remove...");
g_assert (g_bookmark_file_remove_item (bookmark, TEST_URI_1, &error) == TRUE);
g_assert_no_error (error);
g_assert (g_bookmark_file_remove_item (bookmark, TEST_URI_1, &error) == FALSE);
g_assert_error (error, G_BOOKMARK_FILE_ERROR, G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND);
g_clear_error (&error);
if (g_test_verbose ())
g_print ("ok\n");
g_printerr ("ok\n");
return TRUE;
}
......
......@@ -37,7 +37,7 @@ push_value (gint value)
g_cond_wait (&cond, &mutex);
next = value;
if (g_test_verbose ())
g_print ("Thread %p producing next value: %d\n", g_thread_self (), value);
g_printerr ("Thread %p producing next value: %d\n", g_thread_self (), value);
if (value % 10 == 0)
g_cond_broadcast (&cond);
else
......@@ -54,14 +54,14 @@ pop_value (void)
while (next == 0)
{
if (g_test_verbose ())
g_print ("Thread %p waiting for cond\n", g_thread_self ());
g_printerr ("Thread %p waiting for cond\n", g_thread_self ());
g_cond_wait (&cond, &mutex);
}
value = next;
next = 0;
g_cond_broadcast (&cond);
if (g_test_verbose ())
g_print ("Thread %p consuming value %d\n", g_thread_self (), value);
g_printerr ("Thread %p consuming value %d\n", g_thread_self (), value);
g_mutex_unlock (&mutex);
return value;
......@@ -85,7 +85,7 @@ produce_values (gpointer data)
push_value (-1);
if (g_test_verbose ())
g_print ("Thread %p produced %d altogether\n", g_thread_self (), total);
g_printerr ("Thread %p produced %d altogether\n", g_thread_self (), total);
return GINT_TO_POINTER (total);
}
......@@ -106,7 +106,7 @@ consume_values (gpointer data)
}
if (g_test_verbose ())
g_print ("Thread %p accumulated %d\n", g_thread_self (), accum);
g_printerr ("Thread %p accumulated %d\n", g_thread_self (), accum);
return GINT_TO_POINTER (accum);
}
......@@ -190,21 +190,21 @@ cond2_func (gpointer data)
g_atomic_int_inc (&check);
if (g_test_verbose ())
g_print ("thread %d starting, check %d\n", value, g_atomic_int_get (&check));
g_printerr ("thread %d starting, check %d\n", value, g_atomic_int_get (&check));
g_usleep (10000 * value);
g_atomic_int_inc (&check);
if (g_test_verbose ())
g_print ("thread %d reaching barrier, check %d\n", value, g_atomic_int_get (&check));
g_printerr ("thread %d reaching barrier, check %d\n", value, g_atomic_int_get (&check));
ret = barrier_wait (&b);
g_assert_cmpint (g_atomic_int_get (&check), ==, 10);
if (g_test_verbose ())
g_print ("thread %d leaving barrier (%d), check %d\n", value, ret, g_atomic_int_get (&check));
g_printerr ("thread %d leaving barrier (%d), check %d\n", value, ret, g_atomic_int_get (&check));
return NULL;
}
......
......@@ -488,18 +488,18 @@ test_mkdir_with_parents (void)
{
gchar *cwd;
if (g_test_verbose())
g_print ("checking g_mkdir_with_parents() in subdir ./hum/");
g_printerr ("checking g_mkdir_with_parents() in subdir ./hum/");
test_mkdir_with_parents_1 ("hum");
g_remove ("hum");
if (g_test_verbose())
g_print ("checking g_mkdir_with_parents() in subdir ./hii///haa/hee/");
g_printerr ("checking g_mkdir_with_parents() in subdir ./hii///haa/hee/");
test_mkdir_with_parents_1 ("hii///haa/hee");
g_remove ("hii/haa/hee");
g_remove ("hii/haa");
g_remove ("hii");
cwd = g_get_current_dir ();
if (g_test_verbose())
g_print ("checking g_mkdir_with_parents() in cwd: %s", cwd);
g_printerr ("checking g_mkdir_with_parents() in cwd: %s", cwd);
test_mkdir_with_parents_1 (cwd);
g_free (cwd);
......
......@@ -339,7 +339,7 @@ test_GDateTime_new_from_timeval (void)
dt = g_date_time_new_from_timeval_local (&tv);
if (g_test_verbose ())
g_print ("\nDT%04d-%02d-%02dT%02d:%02d:%02d%s\n",
g_printerr ("\nDT%04d-%02d-%02dT%02d:%02d:%02d%s\n",
g_date_time_get_year (dt),
g_date_time_get_month (dt),
g_date_time_get_day_of_month (dt),
......@@ -364,7 +364,7 @@ test_GDateTime_new_from_timeval_utc (void)
dt = g_date_time_new_from_timeval_utc (&tv);
if (g_test_verbose ())
g_print ("\nDT%04d-%02d-%02dT%02d:%02d:%02d%s\n",
g_printerr ("\nDT%04d-%02d-%02dT%02d:%02d:%02d%s\n",
g_date_time_get_year (dt),
g_date_time_get_month (dt),
g_date_time_get_day_of_month (dt),
......@@ -1185,7 +1185,7 @@ test_all_dates (void)
dt = g_date_time_new (timezone, year, month, day, 0, 0, 0);
#if 0
g_print ("%04d-%02d-%02d = %04d-W%02d-%d = %04d-%03d\n",
g_printerr ("%04d-%02d-%02d = %04d-W%02d-%d = %04d-%03d\n",
year, month, day,
week_year, week_num, weekday,
year, day_of_year);
......
......@@ -98,7 +98,7 @@ acquire (gint nr)
if (!g_mutex_trylock (&locks[nr]))
{
if (g_test_verbose ())
g_print ("thread %p going to block on lock %d\n", self, nr);
g_printerr ("thread %p going to block on lock %d\n", self, nr);
g_mutex_lock (&locks[nr]);
}
......
......@@ -328,7 +328,7 @@ sp5_func (gpointer data)
g_assert_cmpint (GPOINTER_TO_INT (value), ==, v);
if (g_test_verbose ())
g_print ("thread %d set sp5\n", v);
g_printerr ("thread %d set sp5\n", v);
g_mutex_lock (&m5);
g_atomic_int_inc (&count5);
g_cond_signal (&c5a);
......@@ -336,7 +336,7 @@ sp5_func (gpointer data)
g_mutex_unlock (&m5);
if (g_test_verbose ())
g_print ("thread %d get sp5\n", v);
g_printerr ("thread %d get sp5\n", v);
value = g_static_private_get (&sp5);
g_assert (value == NULL);
......@@ -359,7 +359,7 @@ test_static_private5 (void)
g_cond_wait (&c5a, &m5);
if (g_test_verbose ())
g_print ("sp5 gets nuked\n");
g_printerr ("sp5 gets nuked\n");
g_static_private_free (&sp5);
......
......@@ -722,7 +722,7 @@ random_test (gconstpointer d)
if (qinf->head != q->head ||
qinf->tail != q->tail ||
qinf->length != q->length)
g_print ("op: %d\n", op);
g_printerr ("op: %d\n", op);
g_assert (qinf->head == q->head);
g_assert (qinf->tail == q->tail);
......
......@@ -85,7 +85,7 @@ acquire (gint nr)
if (!g_rec_mutex_trylock (&locks[nr]))
{
if (g_test_verbose ())
g_print ("thread %p going to block on lock %d\n", self, nr);
g_printerr ("thread %p going to block on lock %d\n", self, nr);
g_rec_mutex_lock (&locks[nr]);
}
......@@ -100,7 +100,7 @@ acquire (gint nr)
g_assert (owners[nr] == self); /* hopefully this is still us... */
if (g_test_verbose ())
g_print ("thread %p recursively taking lock %d\n", self, nr);
g_printerr ("thread %p recursively taking lock %d\n", self, nr);
g_rec_mutex_lock (&locks[nr]); /* we're recursive, after all */
......
......@@ -125,7 +125,7 @@ acquire (gint nr)
if (!g_rw_lock_writer_trylock (&locks[nr]))
{
if (g_test_verbose ())
g_print ("thread %p going to block on lock %d\n", self, nr);
g_printerr ("thread %p going to block on lock %d\n", self, nr);
g_rw_lock_writer_lock (&locks[nr]);
}
......
......@@ -133,7 +133,7 @@ check_integrity (SequenceInfo *info)
#if 0
if (g_sequence_get_length (info->sequence) != info->n_items)
g_print ("%d %d\n",
g_printerr ("%d %d\n",
g_sequence_get_length (info->sequence), info->n_items);
#endif
g_assert (info->n_items == g_queue_get_length (info->queue));
......@@ -402,7 +402,7 @@ dump_info (SequenceInfo *seq)
while (iter != g_sequence_get_end_iter (seq->sequence))
{
Item *item = get_item (iter);
g_print ("%p %p %d\n", list->data, iter, item->number);
g_printerr ("%p %p %d\n", list->data, iter, item->number);
iter = g_sequence_iter_next (iter);
list = list->next;
......@@ -422,7 +422,7 @@ run_random_tests (gconstpointer d)
int k;
#if 0
g_print (" seed: %u\n", seed);
g_printerr (" seed: %u\n", seed);
#endif
g_random_set_seed (seed);
......@@ -443,7 +443,7 @@ run_random_tests (gconstpointer d)
int op = g_random_int_range (0, N_OPS);
#if 0
g_print ("%d on %p\n", op, seq);
g_printerr ("%d on %p\n", op, seq);
#endif
switch (op)
......
......@@ -93,7 +93,7 @@ do_cmdline_test (gconstpointer d)
gboolean res;
err = NULL;
g_print ("test cmdline: %s\n", test->cmdline);
g_printerr ("test cmdline: %s\n", test->cmdline);
res = g_shell_parse_argv (test->cmdline, &argc, &argv, &err);
if (test->error_code == -1)
{
......
......@@ -95,7 +95,7 @@ static void
test_version (void)
{
if (g_test_verbose ())
g_print ("(header %d.%d.%d library %d.%d.%d) ",
g_printerr ("(header %d.%d.%d library %d.%d.%d) ",
GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION,
glib_major_version, glib_minor_version, glib_micro_version);
......
......@@ -250,7 +250,7 @@ celsius_to_fahrenheit (GBinding *binding,
fahrenheit = (9 * celsius / 5) + 32.0;
if (g_test_verbose ())
g_print ("Converting %.2fC to %.2fF\n", celsius, fahrenheit);
g_printerr ("Converting %.2fC to %.2fF\n", celsius, fahrenheit);
g_value_set_double (to_value, fahrenheit);
......@@ -272,7 +272,7 @@ fahrenheit_to_celsius (GBinding *binding,
celsius = 5 * (fahrenheit - 32.0) / 9;
if (g_test_verbose ())
g_print ("Converting %.2fF to %.2fC\n", fahrenheit, celsius);
g_printerr ("Converting %.2fF to %.2fC\n", fahrenheit, celsius);
g_value_set_double (to_value, celsius);
......
......@@ -169,22 +169,22 @@ ref_unref_thread (gpointer data)
/* first, syncronize with other threads,
*/
if (g_test_verbose())
g_print ("WAITING!\n");
g_printerr ("WAITING!\n");
g_mutex_lock (&sync_mutex);
g_mutex_unlock (&sync_mutex);
if (g_test_verbose ())
g_print ("STARTING\n");
g_printerr ("STARTING\n");
/* ref/unref the klass 10000000 times */
for (i = N_REFS; i; i--) {
if (g_test_verbose ())
if (i % 10)
g_print ("%d\n", i);
g_printerr ("%d\n", i);
g_type_class_unref (g_type_class_ref ((GType) data));
}
if (g_test_verbose())
g_print ("DONE !\n");
g_printerr ("DONE !\n");
return NULL;
}
......
......@@ -29,7 +29,7 @@ test_object_init (TestObject *self)
TestObjectPrivate *priv = test_object_get_instance_private (self);
if (g_test_verbose ())
g_print ("Offset of %sPrivate for type '%s': %d\n",
g_printerr ("Offset of %sPrivate for type '%s': %d\n",
G_OBJECT_TYPE_NAME (self),
G_OBJECT_TYPE_NAME (self),
TestObject_private_offset);
......@@ -93,7 +93,7 @@ test_derived_init (TestDerived *self)
TestDerivedPrivate *priv = test_derived_get_instance_private (self);
if (g_test_verbose ())
g_print ("Offset of %sPrivate for type '%s': %d\n",
g_printerr ("Offset of %sPrivate for type '%s': %d\n",
G_OBJECT_TYPE_NAME (self),
G_OBJECT_TYPE_NAME (self),
TestDerived_private_offset);
......@@ -137,7 +137,7 @@ test_mixed_init (TestMixed *self)
TestMixedPrivate *priv = G_TYPE_INSTANCE_GET_PRIVATE (self, test_mixed_get_type (), TestMixedPrivate);
if (g_test_verbose ())
g_print ("Offset of %sPrivate for type '%s': %d\n",
g_printerr ("Offset of %sPrivate for type '%s': %d\n",
G_OBJECT_TYPE_NAME (self),
G_OBJECT_TYPE_NAME (self),
TestMixed_private_offset);
......@@ -181,7 +181,7 @@ test_mixed_derived_init (TestMixedDerived *self)
TestMixedDerivedPrivate *priv = test_mixed_derived_get_instance_private (self);
if (g_test_verbose ())
g_print ("Offset of %sPrivate for type '%s': %d\n",
g_printerr ("Offset of %sPrivate for type '%s': %d\n",
G_OBJECT_TYPE_NAME (self),
G_OBJECT_TYPE_NAME (self),
TestMixedDerived_private_offset);
......
......@@ -132,11 +132,11 @@ test_threaded_class_init (void)
while (g_atomic_int_get (&mtsafe_call_counter) < (3 + 3 + 3 * 3) * NUM_COUNTER_INCREMENTS)
{
if (g_test_verbose())
g_print ("Initializers counted: %u\n", g_atomic_int_get (&mtsafe_call_counter));
g_printerr ("Initializers counted: %u\n", g_atomic_int_get (&mtsafe_call_counter));
g_usleep (50 * 1000); /* wait for threads to complete */
}
if (g_test_verbose())
g_print ("Total initializers: %u\n", g_atomic_int_get (&mtsafe_call_counter));
g_printerr ("Total initializers: %u\n", g_atomic_int_get (&mtsafe_call_counter));
/* ensure non-corrupted counter updates */
g_assert_cmpint (g_atomic_int_get (&mtsafe_call_counter), ==, unsafe_call_counter);
......@@ -265,7 +265,7 @@ test_threaded_weak_ref (void)
GError *error = NULL;
if (g_test_verbose () && (i % (n/20)) == 0)
g_print ("%u%%\n", ((i * 100) / n));
g_printerr ("%u%%\n", ((i * 100) / n));
/* Have an object and a weak ref to it */
data.strong = g_object_new (my_tester0_get_type (), NULL);
......@@ -332,7 +332,7 @@ test_threaded_weak_ref (void)
}
if (g_test_verbose ())
g_print ("Race won by get %u times, unref %u times\n",
g_printerr ("Race won by get %u times, unref %u times\n",
get_wins, unref_wins);
}
......
......@@ -10,7 +10,7 @@
#define DEBUG_MSG(args)
/* #define DEBUG_MSG(args) g_printerr args ; g_printerr ("\n"); */
#define PRINT_MSG(args)
/* #define PRINT_MSG(args) g_print args ; g_print ("\n"); */
/* #define PRINT_MSG(args) g_printerr args ; g_printerr ("\n"); */
#define MAX_THREADS 50
#define MAX_SORTS 5 /* only applies if
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment