mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-13 07:56:17 +01:00
tests: Use g_test_message() rather than g_printerr() in cancellable test
This makes sure the message gets formatted correctly and sent to the right log file. Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
parent
5b12608157
commit
5571aaa1c5
@ -54,12 +54,12 @@ mock_operation_thread (GTask *task,
|
|||||||
if (g_cancellable_is_cancelled (cancellable))
|
if (g_cancellable_is_cancelled (cancellable))
|
||||||
break;
|
break;
|
||||||
if (g_test_verbose ())
|
if (g_test_verbose ())
|
||||||
g_printerr ("THRD: %u iteration %u\n", data->iterations_requested, i);
|
g_test_message ("THRD: %u iteration %u", data->iterations_requested, i);
|
||||||
g_usleep (WAIT_ITERATION * 1000);
|
g_usleep (WAIT_ITERATION * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_test_verbose ())
|
if (g_test_verbose ())
|
||||||
g_printerr ("THRD: %u stopped at %u\n", data->iterations_requested, i);
|
g_test_message ("THRD: %u stopped at %u", data->iterations_requested, i);
|
||||||
data->iterations_done = i;
|
data->iterations_done = i;
|
||||||
|
|
||||||
g_task_return_boolean (task, TRUE);
|
g_task_return_boolean (task, TRUE);
|
||||||
@ -84,8 +84,8 @@ mock_operation_timeout (gpointer user_data)
|
|||||||
if (done)
|
if (done)
|
||||||
{
|
{
|
||||||
if (g_test_verbose ())
|
if (g_test_verbose ())
|
||||||
g_printerr ("LOOP: %u stopped at %u\n", data->iterations_requested,\
|
g_test_message ("LOOP: %u stopped at %u",
|
||||||
data->iterations_done);
|
data->iterations_requested, data->iterations_done);
|
||||||
g_task_return_boolean (task, TRUE);
|
g_task_return_boolean (task, TRUE);
|
||||||
return FALSE; /* don't call timeout again */
|
return FALSE; /* don't call timeout again */
|
||||||
}
|
}
|
||||||
@ -93,8 +93,8 @@ mock_operation_timeout (gpointer user_data)
|
|||||||
{
|
{
|
||||||
data->iterations_done++;
|
data->iterations_done++;
|
||||||
if (g_test_verbose ())
|
if (g_test_verbose ())
|
||||||
g_printerr ("LOOP: %u iteration %u\n", data->iterations_requested,
|
g_test_message ("LOOP: %u iteration %u",
|
||||||
data->iterations_done);
|
data->iterations_requested, data->iterations_done);
|
||||||
return TRUE; /* call timeout */
|
return TRUE; /* call timeout */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -118,14 +118,14 @@ mock_operation_async (guint wait_iterations,
|
|||||||
{
|
{
|
||||||
g_task_run_in_thread (task, mock_operation_thread);
|
g_task_run_in_thread (task, mock_operation_thread);
|
||||||
if (g_test_verbose ())
|
if (g_test_verbose ())
|
||||||
g_printerr ("THRD: %d started\n", wait_iterations);
|
g_test_message ("THRD: %d started", wait_iterations);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_timeout_add_full (G_PRIORITY_DEFAULT, WAIT_ITERATION, mock_operation_timeout,
|
g_timeout_add_full (G_PRIORITY_DEFAULT, WAIT_ITERATION, mock_operation_timeout,
|
||||||
g_object_ref (task), g_object_unref);
|
g_object_ref (task), g_object_unref);
|
||||||
if (g_test_verbose ())
|
if (g_test_verbose ())
|
||||||
g_printerr ("LOOP: %d started\n", wait_iterations);
|
g_test_message ("LOOP: %d started", wait_iterations);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_unref (task);
|
g_object_unref (task);
|
||||||
@ -210,7 +210,7 @@ test_cancel_multiple_concurrent (void)
|
|||||||
g_main_loop_run (loop);
|
g_main_loop_run (loop);
|
||||||
g_assert_cmpint (num_async_operations, ==, 45);
|
g_assert_cmpint (num_async_operations, ==, 45);
|
||||||
if (g_test_verbose ())
|
if (g_test_verbose ())
|
||||||
g_printerr ("CANCEL: %d operations\n", num_async_operations);
|
g_test_message ("CANCEL: %d operations", num_async_operations);
|
||||||
g_cancellable_cancel (cancellable);
|
g_cancellable_cancel (cancellable);
|
||||||
g_assert_true (g_cancellable_is_cancelled (cancellable));
|
g_assert_true (g_cancellable_is_cancelled (cancellable));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user