tests/clutter/timeline: Always print progress to stderr

This helps when the errors happen e.g. in CI pipelines.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1555
This commit is contained in:
Jonas Ådahl 2020-11-08 21:15:56 +01:00 committed by Georges Basile Stavracas Neto
parent b6211bb684
commit 1499bda592

View File

@ -46,8 +46,7 @@ static void
timeline_complete_cb (ClutterTimeline *timeline, timeline_complete_cb (ClutterTimeline *timeline,
TimelineData *data) TimelineData *data)
{ {
if (!g_test_quiet ()) g_printerr ("%i: Completed\n", data->timeline_num);
g_print ("%i: Completed\n", data->timeline_num);
data->completed_count++; data->completed_count++;
} }
@ -62,8 +61,7 @@ timeline_new_frame_cb (ClutterTimeline *timeline,
int frame_no = ((msec * FRAME_COUNT + (FRAME_COUNT * 1000 / FPS) / 2) int frame_no = ((msec * FRAME_COUNT + (FRAME_COUNT * 1000 / FPS) / 2)
/ (FRAME_COUNT * 1000 / FPS)); / (FRAME_COUNT * 1000 / FPS));
if (!g_test_quiet ()) g_printerr ("%i: Doing frame %d, delta = %i\n",
g_print ("%i: Doing frame %d, delta = %i\n",
data->timeline_num, frame_no, data->timeline_num, frame_no,
clutter_timeline_get_delta (timeline)); clutter_timeline_get_delta (timeline));
@ -78,8 +76,7 @@ timeline_marker_reached_cb (ClutterTimeline *timeline,
guint frame_num, guint frame_num,
TimelineData *data) TimelineData *data)
{ {
if (!g_test_quiet ()) g_printerr ("%i: Marker '%s' (%d) reached, delta = %i\n",
g_print ("%i: Marker '%s' (%d) reached, delta = %i\n",
data->timeline_num, marker_name, frame_num, data->timeline_num, marker_name, frame_num,
clutter_timeline_get_delta (timeline)); clutter_timeline_get_delta (timeline));
data->markers_hit = g_slist_prepend (data->markers_hit, data->markers_hit = g_slist_prepend (data->markers_hit,
@ -118,8 +115,7 @@ check_timeline (ClutterTimeline *timeline,
marker_reached_count[i]++; marker_reached_count[i]++;
else else
{ {
if (!g_test_quiet ()) g_printerr ("FAIL: unknown marker '%s' hit for timeline %i\n",
g_print ("FAIL: unknown marker '%s' hit for timeline %i\n",
(char *) node->data, data->timeline_num); (char *) node->data, data->timeline_num);
succeeded = FALSE; succeeded = FALSE;
} }
@ -128,8 +124,7 @@ check_timeline (ClutterTimeline *timeline,
for (i = 0; i < n_markers; i++) for (i = 0; i < n_markers; i++)
if (marker_reached_count[i] != 1) if (marker_reached_count[i] != 1)
{ {
if (!g_test_quiet ()) g_printerr ("FAIL: marker '%s' hit %i times for timeline %i\n",
g_print ("FAIL: marker '%s' hit %i times for timeline %i\n",
markers[i], marker_reached_count[i], data->timeline_num); markers[i], marker_reached_count[i], data->timeline_num);
succeeded = FALSE; succeeded = FALSE;
} }
@ -142,8 +137,7 @@ check_timeline (ClutterTimeline *timeline,
if (missed_frame_count) if (missed_frame_count)
{ {
if (!g_test_quiet ()) g_printerr ("FAIL: missed %i frame%s for timeline %i\n",
g_print ("FAIL: missed %i frame%s for timeline %i\n",
missed_frame_count, missed_frame_count == 1 ? "" : "s", missed_frame_count, missed_frame_count == 1 ? "" : "s",
data->timeline_num); data->timeline_num);
succeeded = FALSE; succeeded = FALSE;
@ -152,8 +146,7 @@ check_timeline (ClutterTimeline *timeline,
if (data->completed_count != 1) if (data->completed_count != 1)
{ {
if (!g_test_quiet ()) g_printerr ("FAIL: timeline %i completed %i times\n",
g_print ("FAIL: timeline %i completed %i times\n",
data->timeline_num, data->completed_count); data->timeline_num, data->completed_count);
succeeded = FALSE; succeeded = FALSE;
} }
@ -276,8 +269,7 @@ timeline_base (void)
clutter_actor_show (stage); clutter_actor_show (stage);
if (!g_test_quiet ()) g_printerr ("Without delay...\n");
g_print ("Without delay...\n");
clutter_timeline_start (timeline_1); clutter_timeline_start (timeline_1);
clutter_timeline_start (timeline_2); clutter_timeline_start (timeline_2);
@ -291,8 +283,7 @@ timeline_base (void)
g_assert (check_timeline (timeline_2, &data_2, TRUE)); g_assert (check_timeline (timeline_2, &data_2, TRUE));
g_assert (check_timeline (timeline_3, &data_3, TRUE)); g_assert (check_timeline (timeline_3, &data_3, TRUE));
if (!g_test_quiet ()) g_printerr ("With delay...\n");
g_print ("With delay...\n");
timeline_data_destroy (&data_1); timeline_data_destroy (&data_1);
timeline_data_init (&data_1, 1); timeline_data_init (&data_1, 1);
@ -339,9 +330,8 @@ timeline_markers_from_script (void)
"scripts", "scripts",
"test-script-timeline-markers.json", "test-script-timeline-markers.json",
NULL); NULL);
clutter_script_load_from_file (script, test_file, &error); if (!clutter_script_load_from_file (script, test_file, &error))
if (!g_test_quiet () && error != NULL) g_printerr ("Error: %s", error->message);
g_print ("Error: %s", error->message);
g_assert_no_error (error); g_assert_no_error (error);