[mutter] tests/clutter/timeline: Always print progress to stderr



commit 1499bda592950a1b8a42ca775e3f703fed39308a
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Sun Nov 8 21:15:56 2020 +0100

    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

 src/tests/clutter/conform/timeline.c | 50 +++++++++++++++---------------------
 1 file changed, 20 insertions(+), 30 deletions(-)
---
diff --git a/src/tests/clutter/conform/timeline.c b/src/tests/clutter/conform/timeline.c
index 5b991ef303..6bd8f32bb2 100644
--- a/src/tests/clutter/conform/timeline.c
+++ b/src/tests/clutter/conform/timeline.c
@@ -46,8 +46,7 @@ static void
 timeline_complete_cb (ClutterTimeline *timeline,
                       TimelineData    *data)
 {
-  if (!g_test_quiet ())
-    g_print ("%i: Completed\n", data->timeline_num);
+  g_printerr ("%i: Completed\n", data->timeline_num);
 
   data->completed_count++;
 }
@@ -62,10 +61,9 @@ timeline_new_frame_cb (ClutterTimeline *timeline,
   int frame_no = ((msec * FRAME_COUNT + (FRAME_COUNT * 1000 / FPS) / 2)
                   / (FRAME_COUNT * 1000 / FPS));
 
-  if (!g_test_quiet ())
-    g_print ("%i: Doing frame %d, delta = %i\n",
-             data->timeline_num, frame_no,
-             clutter_timeline_get_delta (timeline));
+  g_printerr ("%i: Doing frame %d, delta = %i\n",
+              data->timeline_num, frame_no,
+              clutter_timeline_get_delta (timeline));
 
   g_assert (frame_no >= 0 && frame_no <= FRAME_COUNT);
 
@@ -78,10 +76,9 @@ timeline_marker_reached_cb (ClutterTimeline *timeline,
                             guint            frame_num,
                             TimelineData    *data)
 {
-  if (!g_test_quiet ())
-    g_print ("%i: Marker '%s' (%d) reached, delta = %i\n",
-             data->timeline_num, marker_name, frame_num,
-             clutter_timeline_get_delta (timeline));
+  g_printerr ("%i: Marker '%s' (%d) reached, delta = %i\n",
+              data->timeline_num, marker_name, frame_num,
+              clutter_timeline_get_delta (timeline));
   data->markers_hit = g_slist_prepend (data->markers_hit,
                                        g_strdup (marker_name));
 }
@@ -118,9 +115,8 @@ check_timeline (ClutterTimeline *timeline,
         marker_reached_count[i]++;
       else
         {
-          if (!g_test_quiet ())
-            g_print ("FAIL: unknown marker '%s' hit for timeline %i\n",
-                     (char *) node->data, data->timeline_num);
+          g_printerr ("FAIL: unknown marker '%s' hit for timeline %i\n",
+                      (char *) node->data, data->timeline_num);
           succeeded = FALSE;
         }
     }
@@ -128,9 +124,8 @@ check_timeline (ClutterTimeline *timeline,
   for (i = 0; i < n_markers; i++)
     if (marker_reached_count[i] != 1)
       {
-        if (!g_test_quiet ())
-          g_print ("FAIL: marker '%s' hit %i times for timeline %i\n",
-                   markers[i], marker_reached_count[i], data->timeline_num);
+        g_printerr ("FAIL: marker '%s' hit %i times for timeline %i\n",
+                    markers[i], marker_reached_count[i], data->timeline_num);
         succeeded = FALSE;
       }
 
@@ -142,19 +137,17 @@ check_timeline (ClutterTimeline *timeline,
 
       if (missed_frame_count)
         {
-          if (!g_test_quiet ())
-            g_print ("FAIL: missed %i frame%s for timeline %i\n",
-                     missed_frame_count, missed_frame_count == 1 ? "" : "s",
-                     data->timeline_num);
+          g_printerr ("FAIL: missed %i frame%s for timeline %i\n",
+                      missed_frame_count, missed_frame_count == 1 ? "" : "s",
+                      data->timeline_num);
           succeeded = FALSE;
         }
     }
 
   if (data->completed_count != 1)
     {
-      if (!g_test_quiet ())
-        g_print ("FAIL: timeline %i completed %i times\n",
-                 data->timeline_num, data->completed_count);
+      g_printerr ("FAIL: timeline %i completed %i times\n",
+                  data->timeline_num, data->completed_count);
       succeeded = FALSE;
     }
 
@@ -276,8 +269,7 @@ timeline_base (void)
 
   clutter_actor_show (stage);
 
-  if (!g_test_quiet ())
-    g_print ("Without delay...\n");
+  g_printerr ("Without delay...\n");
 
   clutter_timeline_start (timeline_1);
   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_3, &data_3, TRUE));
 
-  if (!g_test_quiet ())
-    g_print ("With delay...\n");
+  g_printerr ("With delay...\n");
 
   timeline_data_destroy (&data_1);
   timeline_data_init (&data_1, 1);
@@ -339,9 +330,8 @@ timeline_markers_from_script (void)
                                      "scripts",
                                      "test-script-timeline-markers.json",
                                      NULL);
-  clutter_script_load_from_file (script, test_file, &error);
-  if (!g_test_quiet () && error != NULL)
-    g_print ("Error: %s", error->message);
+  if (!clutter_script_load_from_file (script, test_file, &error))
+    g_printerr ("Error: %s", error->message);
 
   g_assert_no_error (error);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]