mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-07-30 05:43:28 +02:00
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 <walters@verbum.org> Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user