From 45dae4b5063f9af7de8211ced95dd73cc770a86e Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 11 May 2015 17:03:00 +0100 Subject: [PATCH] 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=725981 Reviewed-by: Colin Walters Signed-off-by: Simon McVittie --- gio/tests/defaultvalue.c | 2 +- gio/tests/g-file.c | 4 +- gio/tests/gdbus-connection.c | 2 +- gio/tests/gdbus-export.c | 10 +- gio/tests/gdbus-peer.c | 4 +- gio/tests/gdbus-proxy-threads.c | 4 +- gio/tests/gdbus-test-codegen.c | 2 +- gio/tests/gdbus-threading.c | 12 +-- gio/tests/live-g-file.c | 12 +-- glib/tests/1bit-mutex.c | 2 +- glib/tests/base64.c | 4 +- glib/tests/bookmarkfile.c | 26 ++--- glib/tests/cond.c | 16 +-- glib/tests/fileutils.c | 6 +- glib/tests/gdatetime.c | 6 +- glib/tests/mutex.c | 2 +- glib/tests/private.c | 6 +- glib/tests/queue.c | 2 +- glib/tests/rec-mutex.c | 4 +- glib/tests/rwlock.c | 2 +- glib/tests/sequence.c | 8 +- glib/tests/shell.c | 2 +- glib/tests/utils.c | 2 +- gobject/tests/binding.c | 4 +- gobject/tests/dynamictests.c | 8 +- gobject/tests/private.c | 8 +- gobject/tests/threadtests.c | 8 +- tests/asyncqueue-test.c | 2 +- tests/testglib.c | 182 ++++++++++++++++---------------- 29 files changed, 176 insertions(+), 176 deletions(-) diff --git a/gio/tests/defaultvalue.c b/gio/tests/defaultvalue.c index f83327b31..965402b3d 100644 --- a/gio/tests/defaultvalue.c +++ b/gio/tests/defaultvalue.c @@ -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); diff --git a/gio/tests/g-file.c b/gio/tests/g-file.c index 9e3a6331a..f87c1b1d8 100644 --- a/gio/tests/g-file.c +++ b/gio/tests/g-file.c @@ -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); diff --git a/gio/tests/gdbus-connection.c b/gio/tests/gdbus-connection.c index 80cec2246..015524c79 100644 --- a/gio/tests/gdbus-connection.c +++ b/gio/tests/gdbus-connection.c @@ -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); diff --git a/gio/tests/gdbus-export.c b/gio/tests/gdbus-export.c index 75020234a..594050152 100644 --- a/gio/tests/gdbus-export.c +++ b/gio/tests/gdbus-export.c @@ -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); diff --git a/gio/tests/gdbus-peer.c b/gio/tests/gdbus-peer.c index 2c702ab06..2bb3b8a02 100644 --- a/gio/tests/gdbus-peer.c +++ b/gio/tests/gdbus-peer.c @@ -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); */ diff --git a/gio/tests/gdbus-proxy-threads.c b/gio/tests/gdbus-proxy-threads.c index a019efe3f..c25b8e76f 100644 --- a/gio/tests/gdbus-proxy-threads.c +++ b/gio/tests/gdbus-proxy-threads.c @@ -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 diff --git a/gio/tests/gdbus-test-codegen.c b/gio/tests/gdbus-test-codegen.c index 62c17e08d..4abe5a1eb 100644 --- a/gio/tests/gdbus-test-codegen.c +++ b/gio/tests/gdbus-test-codegen.c @@ -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)); diff --git a/gio/tests/gdbus-threading.c b/gio/tests/gdbus-threading.c index 0f5253be7..8d656c62d 100644 --- a/gio/tests/gdbus-threading.c +++ b/gio/tests/gdbus-threading.c @@ -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); } /* ---------------------------------------------------------------------------------------------------- */ diff --git a/gio/tests/live-g-file.c b/gio/tests/live-g-file.c index 6edc99a59..ba9d8d230 100644 --- a/gio/tests/live-g-file.c +++ b/gio/tests/live-g-file.c @@ -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 (); } diff --git a/glib/tests/1bit-mutex.c b/glib/tests/1bit-mutex.c index 897bd4b13..fb29ec1e8 100644 --- a/glib/tests/1bit-mutex.c +++ b/glib/tests/1bit-mutex.c @@ -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]); diff --git a/glib/tests/base64.c b/glib/tests/base64.c index e1420e101..2d6b3a162 100644 --- a/glib/tests/base64.c +++ b/glib/tests/base64.c @@ -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); diff --git a/glib/tests/bookmarkfile.c b/glib/tests/bookmarkfile.c index 13bf7f5c3..c81561ea2 100644 --- a/glib/tests/bookmarkfile.c +++ b/glib/tests/bookmarkfile.c @@ -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; } diff --git a/glib/tests/cond.c b/glib/tests/cond.c index f9ef3e20e..0987f01e0 100644 --- a/glib/tests/cond.c +++ b/glib/tests/cond.c @@ -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; } diff --git a/glib/tests/fileutils.c b/glib/tests/fileutils.c index f1331700a..550c4d874 100644 --- a/glib/tests/fileutils.c +++ b/glib/tests/fileutils.c @@ -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); diff --git a/glib/tests/gdatetime.c b/glib/tests/gdatetime.c index 4241f7b2f..967cc051e 100644 --- a/glib/tests/gdatetime.c +++ b/glib/tests/gdatetime.c @@ -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); diff --git a/glib/tests/mutex.c b/glib/tests/mutex.c index 3bd2e2fe1..14e83cf69 100644 --- a/glib/tests/mutex.c +++ b/glib/tests/mutex.c @@ -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]); } diff --git a/glib/tests/private.c b/glib/tests/private.c index d23259c12..6e6eba167 100644 --- a/glib/tests/private.c +++ b/glib/tests/private.c @@ -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); diff --git a/glib/tests/queue.c b/glib/tests/queue.c index 4f5e753a8..9f4d3c2ca 100644 --- a/glib/tests/queue.c +++ b/glib/tests/queue.c @@ -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); diff --git a/glib/tests/rec-mutex.c b/glib/tests/rec-mutex.c index 95ac03fb9..5b2f9c221 100644 --- a/glib/tests/rec-mutex.c +++ b/glib/tests/rec-mutex.c @@ -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 */ diff --git a/glib/tests/rwlock.c b/glib/tests/rwlock.c index 658009dfc..1ddc3a03e 100644 --- a/glib/tests/rwlock.c +++ b/glib/tests/rwlock.c @@ -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]); } diff --git a/glib/tests/sequence.c b/glib/tests/sequence.c index fcc838579..27a7f5ad3 100644 --- a/glib/tests/sequence.c +++ b/glib/tests/sequence.c @@ -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) diff --git a/glib/tests/shell.c b/glib/tests/shell.c index a1b92ddd9..c8b2bcc5e 100644 --- a/glib/tests/shell.c +++ b/glib/tests/shell.c @@ -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) { diff --git a/glib/tests/utils.c b/glib/tests/utils.c index 0441cd328..65ca806e0 100644 --- a/glib/tests/utils.c +++ b/glib/tests/utils.c @@ -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); diff --git a/gobject/tests/binding.c b/gobject/tests/binding.c index f79640b99..ac82f6d14 100644 --- a/gobject/tests/binding.c +++ b/gobject/tests/binding.c @@ -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); diff --git a/gobject/tests/dynamictests.c b/gobject/tests/dynamictests.c index a052e1a61..d299c3f27 100644 --- a/gobject/tests/dynamictests.c +++ b/gobject/tests/dynamictests.c @@ -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; } diff --git a/gobject/tests/private.c b/gobject/tests/private.c index a960e50e0..ecf5e7b71 100644 --- a/gobject/tests/private.c +++ b/gobject/tests/private.c @@ -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); diff --git a/gobject/tests/threadtests.c b/gobject/tests/threadtests.c index e075c5722..7408c0a8c 100644 --- a/gobject/tests/threadtests.c +++ b/gobject/tests/threadtests.c @@ -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); } diff --git a/tests/asyncqueue-test.c b/tests/asyncqueue-test.c index 84d7810b8..0cf67b21b 100644 --- a/tests/asyncqueue-test.c +++ b/tests/asyncqueue-test.c @@ -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 diff --git a/tests/testglib.c b/tests/testglib.c index db3ef3e28..0a6f79047 100644 --- a/tests/testglib.c +++ b/tests/testglib.c @@ -71,7 +71,7 @@ my_list_compare_two (gconstpointer a, gconstpointer b) my_list_print (gpointer a, gpointer b) { gint three = *((gint*)a); - g_print("%d", three); + g_printerr ("%d", three); }; */ static void @@ -102,7 +102,7 @@ glist_test (void) list = g_list_insert_sorted (list, &more_nums[i], my_list_compare_one); /* - g_print("\n"); + g_printerr ("\n"); g_list_foreach (list, my_list_print, NULL); */ @@ -120,7 +120,7 @@ glist_test (void) list = g_list_insert_sorted (list, &more_nums[i], my_list_compare_two); /* - g_print("\n"); + g_printerr ("\n"); g_list_foreach (list, my_list_print, NULL); */ @@ -140,7 +140,7 @@ glist_test (void) list = g_list_sort (list, my_list_compare_two); /* - g_print("\n"); + g_printerr ("\n"); g_list_foreach (list, my_list_print, NULL); */ @@ -178,7 +178,7 @@ gslist_test (void) slist = g_slist_insert_sorted (slist, &more_nums[i], my_list_compare_one); /* - g_print("\n"); + g_printerr ("\n"); g_slist_foreach (slist, my_list_print, NULL); */ @@ -196,7 +196,7 @@ gslist_test (void) slist = g_slist_insert_sorted (slist, &more_nums[i], my_list_compare_two); /* - g_print("\n"); + g_printerr ("\n"); g_slist_foreach (slist, my_list_print, NULL); */ @@ -216,7 +216,7 @@ gslist_test (void) slist = g_slist_sort (slist, my_list_compare_two); /* - g_print("\n"); + g_printerr ("\n"); g_slist_foreach (slist, my_list_print, NULL); */ @@ -393,7 +393,7 @@ my_traverse (gpointer key, gpointer data) { char *ch = key; - g_print ("%c ", *ch); + g_printerr ("%c ", *ch); return FALSE; } @@ -427,9 +427,9 @@ binary_tree_test (void) if (g_test_verbose()) { - g_print ("tree: "); + g_printerr ("tree: "); g_tree_foreach (tree, my_traverse, NULL); - g_print ("\n"); + g_printerr ("\n"); } for (i = 0; i < 10; i++) @@ -440,9 +440,9 @@ binary_tree_test (void) if (g_test_verbose()) { - g_print ("tree: "); + g_printerr ("tree: "); g_tree_foreach (tree, my_traverse, NULL); - g_print ("\n"); + g_printerr ("\n"); } g_tree_unref (tree); @@ -591,69 +591,69 @@ timer_tests (void) if (g_test_slow()) { if (g_test_verbose()) - g_print ("checking timers...\n"); + g_printerr ("checking timers...\n"); timer = g_timer_new (); if (g_test_verbose()) - g_print (" spinning for 3 seconds...\n"); + g_printerr (" spinning for 3 seconds...\n"); g_timer_start (timer); while (g_timer_elapsed (timer, NULL) < 3) ; g_timer_stop (timer); g_timer_destroy (timer); if (g_test_verbose()) - g_print ("ok\n"); + g_printerr ("ok\n"); } if (g_test_slow()) { gulong elapsed_usecs; if (g_test_verbose()) - g_print ("checking g_timer_continue...\n"); + g_printerr ("checking g_timer_continue...\n"); timer2 = g_timer_new (); if (g_test_verbose()) - g_print ("\trun for 1 second...\n"); + g_printerr ("\trun for 1 second...\n"); timer = g_timer_new(); g_usleep (G_USEC_PER_SEC); /* run timer for 1 second */ g_timer_stop (timer); if (g_test_verbose()) - g_print ("\tstop for 1 second...\n"); + g_printerr ("\tstop for 1 second...\n"); g_usleep (G_USEC_PER_SEC); /* wait for 1 second */ if (g_test_verbose()) - g_print ("\trun for 2 seconds...\n"); + g_printerr ("\trun for 2 seconds...\n"); g_timer_continue (timer); g_usleep (2 * G_USEC_PER_SEC); /* run timer for 2 seconds */ g_timer_stop(timer); if (g_test_verbose()) - g_print ("\tstop for 1.5 seconds...\n"); + g_printerr ("\tstop for 1.5 seconds...\n"); g_usleep ((3 * G_USEC_PER_SEC) / 2); /* wait for 1.5 seconds */ if (g_test_verbose()) - g_print ("\trun for 0.2 seconds...\n"); + g_printerr ("\trun for 0.2 seconds...\n"); g_timer_continue (timer); g_usleep (G_USEC_PER_SEC / 5); /* run timer for 0.2 seconds */ g_timer_stop (timer); if (g_test_verbose()) - g_print ("\tstop for 4 seconds...\n"); + g_printerr ("\tstop for 4 seconds...\n"); g_usleep (4 * G_USEC_PER_SEC); /* wait for 4 seconds */ if (g_test_verbose()) - g_print ("\trun for 5.8 seconds...\n"); + g_printerr ("\trun for 5.8 seconds...\n"); g_timer_continue (timer); g_usleep ((29 * G_USEC_PER_SEC) / 5); /* run timer for 5.8 seconds */ g_timer_stop(timer); elapsed = g_timer_elapsed (timer, &elapsed_usecs); if (g_test_verbose()) - g_print ("\t=> timer = %.6f = %d.%06ld (should be: 9.000000) (%.6f off)\n", elapsed, (int) elapsed, elapsed_usecs, ABS (elapsed - 9.)); + g_printerr ("\t=> timer = %.6f = %d.%06ld (should be: 9.000000) (%.6f off)\n", elapsed, (int) elapsed, elapsed_usecs, ABS (elapsed - 9.)); g_assert_cmpfloat (elapsed, >, 8.8); g_assert_cmpfloat (elapsed, <, 9.2); if (g_test_verbose()) - g_print ("g_timer_continue ... ok\n\n"); + g_printerr ("g_timer_continue ... ok\n\n"); g_timer_stop (timer2); elapsed = g_timer_elapsed (timer2, &elapsed_usecs); if (g_test_verbose()) - g_print ("\t=> timer2 = %.6f = %d.%06ld (should be: %.6f) (%.6f off)\n\n", elapsed, (int) elapsed, elapsed_usecs, 9.+6.5, ABS (elapsed - (9.+6.5))); + g_printerr ("\t=> timer2 = %.6f = %d.%06ld (should be: %.6f) (%.6f off)\n\n", elapsed, (int) elapsed, elapsed_usecs, 9.+6.5, ABS (elapsed - (9.+6.5))); g_assert_cmpfloat (elapsed, >, 8.8 + 6.5); g_assert_cmpfloat (elapsed, <, 9.2 + 6.5); if (g_test_verbose()) - g_print ("timer2 ... ok\n\n"); + g_printerr ("timer2 ... ok\n\n"); g_timer_destroy (timer); g_timer_destroy (timer2); } @@ -673,7 +673,7 @@ type_sizes (void) g_assert_cmpint (sizeof (gint64), ==, 8); /* endian macros */ if (g_test_verbose()) - g_print ("checking endian macros (host is %s)...\n", + g_printerr ("checking endian macros (host is %s)...\n", G_BYTE_ORDER == G_BIG_ENDIAN ? "big endian" : "little endian"); g_assert (GUINT16_SWAP_LE_BE (gu16t1) == gu16t2); g_assert (GUINT32_SWAP_LE_BE (gu32t1) == gu32t2); @@ -690,7 +690,7 @@ test_info (void) const gchar *charset; gboolean charset_is_utf8; if (g_test_verbose()) - g_print ("TestGLib v%u.%u.%u (i:%u b:%u)\n", + g_printerr ("TestGLib v%u.%u.%u (i:%u b:%u)\n", glib_major_version, glib_minor_version, glib_micro_version, @@ -703,10 +703,10 @@ test_info (void) hn = g_get_host_name(); if (g_test_verbose()) { - g_print ("cwd: %s\n", cwd); - g_print ("user: %s\n", un); - g_print ("real: %s\n", rn); - g_print ("host: %s\n", hn); + g_printerr ("cwd: %s\n", cwd); + g_printerr ("user: %s\n", un); + g_printerr ("real: %s\n", rn); + g_printerr ("host: %s\n", hn); } g_free (cwd); @@ -741,18 +741,18 @@ test_info (void) if (g_test_verbose()) { - g_print ("tmp-dir: %s\n", tmpdir); - g_print ("home: %s\n", homedir); - g_print ("user_data: %s\n", userdatadir); - g_print ("user_config: %s\n", uconfdir); - g_print ("user_cache: %s\n", ucachedir); - g_print ("user_runtime: %s\n", uruntimedir); - g_print ("system_data: %s\n", sdatadirs); - g_print ("system_config: %s\n", sconfdirs); - g_print ("languages: %s\n", langnames); - g_print ("user_special[DESKTOP]: %s\n", uddesktop); - g_print ("user_special[DOCUMENTS]: %s\n", udddocs); - g_print ("user_special[PUBLIC_SHARE]: %s\n", uddpubshare); + g_printerr ("tmp-dir: %s\n", tmpdir); + g_printerr ("home: %s\n", homedir); + g_printerr ("user_data: %s\n", userdatadir); + g_printerr ("user_config: %s\n", uconfdir); + g_printerr ("user_cache: %s\n", ucachedir); + g_printerr ("user_runtime: %s\n", uruntimedir); + g_printerr ("system_data: %s\n", sdatadirs); + g_printerr ("system_config: %s\n", sconfdirs); + g_printerr ("languages: %s\n", langnames); + g_printerr ("user_special[DESKTOP]: %s\n", uddesktop); + g_printerr ("user_special[DOCUMENTS]: %s\n", udddocs); + g_printerr ("user_special[PUBLIC_SHARE]: %s\n", uddpubshare); } g_free (sdatadirs); g_free (sconfdirs); @@ -763,20 +763,20 @@ test_info (void) if (g_test_verbose()) { if (charset_is_utf8) - g_print ("current charset is UTF-8: %s\n", charset); + g_printerr ("current charset is UTF-8: %s\n", charset); else - g_print ("current charset is not UTF-8: %s\n", charset); + g_printerr ("current charset is not UTF-8: %s\n", charset); } if (g_test_verbose()) { #ifdef G_PLATFORM_WIN32 - g_print ("current locale: %s\n", g_win32_getlocale ()); + g_printerr ("current locale: %s\n", g_win32_getlocale ()); - g_print ("found more.com as %s\n", g_find_program_in_path ("more.com")); - g_print ("found regedit as %s\n", g_find_program_in_path ("regedit")); + g_printerr ("found more.com as %s\n", g_find_program_in_path ("more.com")); + g_printerr ("found regedit as %s\n", g_find_program_in_path ("regedit")); - g_print ("a Win32 error message: %s\n", g_win32_error_message (2)); + g_printerr ("a Win32 error message: %s\n", g_win32_error_message (2)); #endif } } @@ -841,7 +841,7 @@ test_paths (void) gchar *string; guint i; if (g_test_verbose()) - g_print ("checking g_path_get_basename()..."); + g_printerr ("checking g_path_get_basename()..."); string = g_path_get_basename (G_DIR_SEPARATOR_S "foo" G_DIR_SEPARATOR_S "dir" G_DIR_SEPARATOR_S); g_assert (strcmp (string, "dir") == 0); g_free (string); @@ -849,7 +849,7 @@ test_paths (void) g_assert (strcmp (string, "file") == 0); g_free (string); if (g_test_verbose()) - g_print ("ok\n"); + g_printerr ("ok\n"); #ifdef G_OS_WIN32 string = g_path_get_basename ("/foo/dir/"); @@ -861,7 +861,7 @@ test_paths (void) #endif if (g_test_verbose()) - g_print ("checking g_path_get_dirname()..."); + g_printerr ("checking g_path_get_dirname()..."); for (i = 0; i < n_dirname_checks; i++) { gchar *dirname = g_path_get_dirname (dirname_checks[i].filename); @@ -875,10 +875,10 @@ test_paths (void) g_free (dirname); } if (g_test_verbose()) - g_print ("ok\n"); + g_printerr ("ok\n"); if (g_test_verbose()) - g_print ("checking g_path_skip_root()..."); + g_printerr ("checking g_path_skip_root()..."); for (i = 0; i < n_skip_root_checks; i++) { const gchar *skipped = g_path_skip_root (skip_root_checks[i].filename); @@ -895,7 +895,7 @@ test_paths (void) } } if (g_test_verbose()) - g_print ("ok\n"); + g_printerr ("ok\n"); } static void @@ -911,7 +911,7 @@ test_file_functions (void) strcpy (template, "foobar"); fd = g_mkstemp (template); if (g_test_verbose() && fd != -1) - g_print ("g_mkstemp works even if template doesn't end in XXXXXX\n"); + g_printerr ("g_mkstemp works even if template doesn't end in XXXXXX\n"); if (fd != -1) close (fd); strcpy (template, "fooXXXXXX"); @@ -945,9 +945,9 @@ test_file_functions (void) if (g_test_verbose()) { if (fd != -1) - g_print ("g_file_open_tmp works even if template contains '%s'\n", G_DIR_SEPARATOR_S); + g_printerr ("g_file_open_tmp works even if template contains '%s'\n", G_DIR_SEPARATOR_S); else - g_print ("g_file_open_tmp correctly returns error: %s\n", error->message); + g_printerr ("g_file_open_tmp correctly returns error: %s\n", error->message); } if (fd != -1) close (fd); @@ -961,9 +961,9 @@ test_file_functions (void) if (g_test_verbose()) { if (fd != -1) - g_print ("g_file_open_tmp works even if template contains '/'\n"); + g_printerr ("g_file_open_tmp works even if template contains '/'\n"); else - g_print ("g_file_open_tmp correctly returns error: %s\n", error->message); + g_printerr ("g_file_open_tmp correctly returns error: %s\n", error->message); } if (fd != -1) close (fd); @@ -977,7 +977,7 @@ test_file_functions (void) if (fd == -1) g_error ("g_file_open_tmp didn't work for template '%s': %s\n", template, error->message); else if (g_test_verbose()) - g_print ("g_file_open_tmp for template '%s' used name '%s'\n", template, name_used); + g_printerr ("g_file_open_tmp for template '%s' used name '%s'\n", template, name_used); if (fd != -1) close (fd); g_clear_error (&error); @@ -1158,7 +1158,7 @@ gstring_tests (void) guint i; if (g_test_verbose()) - g_print ("test GString basics\n"); + g_printerr ("test GString basics\n"); string1 = g_string_new ("hi pete!"); string2 = g_string_new (""); @@ -1187,18 +1187,18 @@ gstring_tests (void) #endif if (g_test_verbose()) - g_print ("string2 length = %lu...\n", (gulong)string2->len); + g_printerr ("string2 length = %lu...\n", (gulong)string2->len); string2->str[70] = '\0'; if (g_test_verbose()) - g_print ("first 70 chars:\n%s\n", string2->str); + g_printerr ("first 70 chars:\n%s\n", string2->str); string2->str[141] = '\0'; if (g_test_verbose()) - g_print ("next 70 chars:\n%s\n", string2->str+71); + g_printerr ("next 70 chars:\n%s\n", string2->str+71); string2->str[212] = '\0'; if (g_test_verbose()) - g_print ("and next 70:\n%s\n", string2->str+142); + g_printerr ("and next 70:\n%s\n", string2->str+142); if (g_test_verbose()) - g_print ("last 70 chars:\n%s\n", string2->str+string2->len - 70); + g_printerr ("last 70 chars:\n%s\n", string2->str+string2->len - 70); g_string_free (string1, TRUE); g_string_free (string2, TRUE); @@ -1268,7 +1268,7 @@ gstring_tests (void) /* Check handling of embedded ASCII 0 (NUL) characters in GString. */ if (g_test_verbose()) - g_print ("test embedded ASCII 0 (NUL) characters in GString\n"); + g_printerr ("test embedded ASCII 0 (NUL) characters in GString\n"); string1 = g_string_new ("fiddle"); string2 = g_string_new ("fiddle"); g_assert (g_string_equal(string1, string2)); @@ -1299,7 +1299,7 @@ various_string_tests (void) const gchar *tz; if (g_test_verbose()) - g_print ("checking string chunks..."); + g_printerr ("checking string chunks..."); string_chunk = g_string_chunk_new (1024); for (i = 0; i < 100000; i ++) { @@ -1314,11 +1314,11 @@ various_string_tests (void) g_string_chunk_free (string_chunk); if (g_test_verbose()) - g_print ("test positional printf formats (not supported):"); + g_printerr ("test positional printf formats (not supported):"); string = g_strdup_printf ("%.*s%s", 5, "a", "b"); tmp_string = g_strdup_printf ("%2$*1$s", 5, "c"); if (g_test_verbose()) - g_print ("%s%s\n", string, tmp_string); + g_printerr ("%s%s\n", string, tmp_string); g_free (tmp_string); g_free (string); @@ -1339,7 +1339,7 @@ various_string_tests (void) #define REF_STR_DATE_ONLY "1980-02-22" if (g_test_verbose()) - g_print ("checking g_time_val_from_iso8601...\n"); + g_printerr ("checking g_time_val_from_iso8601...\n"); ref_date.tv_sec = REF_SEC_UTC; ref_date.tv_usec = 0; g_assert (g_time_val_from_iso8601 (REF_INVALID1, &date) == FALSE); @@ -1348,7 +1348,7 @@ various_string_tests (void) g_assert (g_time_val_from_iso8601 (REF_STR_DATE_ONLY, &date) == FALSE); g_assert (g_time_val_from_iso8601 (REF_STR_UTC, &date) != FALSE); if (g_test_verbose()) - g_print ("\t=> UTC stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n", + g_printerr ("\t=> UTC stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n", date.tv_sec, date.tv_usec, ref_date.tv_sec, ref_date.tv_usec, date.tv_sec - ref_date.tv_sec, date.tv_usec - ref_date.tv_usec); g_assert (date.tv_sec == ref_date.tv_sec && date.tv_usec == ref_date.tv_usec); @@ -1360,7 +1360,7 @@ various_string_tests (void) g_assert (g_time_val_from_iso8601 (REF_STR_LOCAL, &date) != FALSE); if (g_test_verbose()) - g_print ("\t=> LOCAL stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n", + g_printerr ("\t=> LOCAL stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n", date.tv_sec, date.tv_usec, ref_date.tv_sec, ref_date.tv_usec, date.tv_sec - ref_date.tv_sec, date.tv_usec - ref_date.tv_usec); g_assert (date.tv_sec == ref_date.tv_sec && date.tv_usec == ref_date.tv_usec); @@ -1374,21 +1374,21 @@ various_string_tests (void) g_assert (g_time_val_from_iso8601 (REF_STR_CEST, &date) != FALSE); if (g_test_verbose()) - g_print ("\t=> CEST stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n", + g_printerr ("\t=> CEST stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n", date.tv_sec, date.tv_usec, ref_date.tv_sec, ref_date.tv_usec, date.tv_sec - ref_date.tv_sec, date.tv_usec - ref_date.tv_usec); g_assert (date.tv_sec == ref_date.tv_sec && date.tv_usec == ref_date.tv_usec); g_assert (g_time_val_from_iso8601 (REF_STR_EST, &date) != FALSE); if (g_test_verbose()) - g_print ("\t=> EST stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n", + g_printerr ("\t=> EST stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n", date.tv_sec, date.tv_usec, ref_date.tv_sec, ref_date.tv_usec, date.tv_sec - ref_date.tv_sec, date.tv_usec - ref_date.tv_usec); g_assert (date.tv_sec == ref_date.tv_sec && date.tv_usec == ref_date.tv_usec); g_assert (g_time_val_from_iso8601 (REF_STR_NST, &date) != FALSE); if (g_test_verbose()) - g_print ("\t=> NST stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n", + g_printerr ("\t=> NST stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n", date.tv_sec, date.tv_usec, ref_date.tv_sec, ref_date.tv_usec, date.tv_sec - ref_date.tv_sec, date.tv_usec - ref_date.tv_usec); g_assert (date.tv_sec == ref_date.tv_sec && date.tv_usec == ref_date.tv_usec); @@ -1396,40 +1396,40 @@ various_string_tests (void) ref_date.tv_usec = REF_USEC_UTC; g_assert (g_time_val_from_iso8601 (REF_STR_USEC_UTC, &date) != FALSE); if (g_test_verbose()) - g_print ("\t=> UTC stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n", + g_printerr ("\t=> UTC stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n", date.tv_sec, date.tv_usec, ref_date.tv_sec, ref_date.tv_usec, date.tv_sec - ref_date.tv_sec, date.tv_usec - ref_date.tv_usec); g_assert (date.tv_sec == ref_date.tv_sec && date.tv_usec == ref_date.tv_usec); g_assert (g_time_val_from_iso8601 (REF_STR_USEC_CEST, &date) != FALSE); if (g_test_verbose()) - g_print ("\t=> CEST stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n", + g_printerr ("\t=> CEST stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n", date.tv_sec, date.tv_usec, ref_date.tv_sec, ref_date.tv_usec, date.tv_sec - ref_date.tv_sec, date.tv_usec - ref_date.tv_usec); g_assert (date.tv_sec == ref_date.tv_sec && date.tv_usec == ref_date.tv_usec); g_assert (g_time_val_from_iso8601 (REF_STR_USEC_EST, &date) != FALSE); if (g_test_verbose()) - g_print ("\t=> EST stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n", + g_printerr ("\t=> EST stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n", date.tv_sec, date.tv_usec, ref_date.tv_sec, ref_date.tv_usec, date.tv_sec - ref_date.tv_sec, date.tv_usec - ref_date.tv_usec); g_assert (date.tv_sec == ref_date.tv_sec && date.tv_usec == ref_date.tv_usec); g_assert (g_time_val_from_iso8601 (REF_STR_USEC_NST, &date) != FALSE); if (g_test_verbose()) - g_print ("\t=> NST stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n", + g_printerr ("\t=> NST stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n", date.tv_sec, date.tv_usec, ref_date.tv_sec, ref_date.tv_usec, date.tv_sec - ref_date.tv_sec, date.tv_usec - ref_date.tv_usec); g_assert (date.tv_sec == ref_date.tv_sec && date.tv_usec == ref_date.tv_usec); if (g_test_verbose()) - g_print ("checking g_time_val_to_iso8601...\n"); + g_printerr ("checking g_time_val_to_iso8601...\n"); ref_date.tv_sec = REF_SEC_UTC; ref_date.tv_usec = 0; date_str = g_time_val_to_iso8601 (&ref_date); g_assert (date_str != NULL); if (g_test_verbose()) - g_print ("\t=> date string = %s (should be: %s)\n", date_str, REF_STR_UTC); + g_printerr ("\t=> date string = %s (should be: %s)\n", date_str, REF_STR_UTC); g_assert (strcmp (date_str, REF_STR_UTC) == 0); g_free (date_str); @@ -1437,12 +1437,12 @@ various_string_tests (void) date_str = g_time_val_to_iso8601 (&ref_date); g_assert (date_str != NULL); if (g_test_verbose()) - g_print ("\t=> date string = %s (should be: %s)\n", date_str, REF_STR_USEC_UTC); + g_printerr ("\t=> date string = %s (should be: %s)\n", date_str, REF_STR_USEC_UTC); g_assert (strcmp (date_str, REF_STR_USEC_UTC) == 0); g_free (date_str); if (g_test_verbose()) - g_print ("checking g_ascii_strcasecmp..."); + g_printerr ("checking g_ascii_strcasecmp..."); g_assert (g_ascii_strcasecmp ("FroboZZ", "frobozz") == 0); g_assert (g_ascii_strcasecmp ("frobozz", "frobozz") == 0); g_assert (g_ascii_strcasecmp ("frobozz", "FROBOZZ") == 0); @@ -1459,7 +1459,7 @@ various_string_tests (void) g_assert (g_ascii_strcasecmp ("B", "A") > 0); if (g_test_verbose()) - g_print ("checking g_strdup...\n"); + g_printerr ("checking g_strdup...\n"); g_assert (g_strdup (NULL) == NULL); string = g_strdup (GLIB_TEST_STRING); g_assert (string != NULL); @@ -1467,7 +1467,7 @@ various_string_tests (void) g_free (string); if (g_test_verbose()) - g_print ("checking g_strconcat...\n"); + g_printerr ("checking g_strconcat...\n"); string = g_strconcat (GLIB_TEST_STRING, NULL); g_assert (string != NULL); g_assert (strcmp (string, GLIB_TEST_STRING) == 0); @@ -1480,7 +1480,7 @@ various_string_tests (void) g_free (string); if (g_test_verbose()) - g_print ("checking g_strlcpy/g_strlcat..."); + g_printerr ("checking g_strlcpy/g_strlcat..."); /* The following is a torture test for strlcpy/strlcat, with lots of * checking; normal users wouldn't use them this way! */ @@ -1535,7 +1535,7 @@ various_string_tests (void) g_free(string); if (g_test_verbose()) - g_print ("checking g_strdup_printf...\n"); + g_printerr ("checking g_strdup_printf...\n"); string = g_strdup_printf ("%05d %-5s", 21, "test"); g_assert (string != NULL); g_assert (strcmp(string, "00021 test ") == 0);