[mutter] headless-start-test: Ignore frame counter warnings



commit f869e4d54bafba9209e5d316e2124c721f7c0568
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Fri May 17 17:35:30 2019 -0500

    headless-start-test: Ignore frame counter warnings
    
    When running in slow or busy machines (hey CI!) or under valgrind headless
    tests could fail because of a non fatal warning during initialization.
    
    So define a fatal handler that ignores the frame counter warning.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/581

 src/tests/headless-start-test.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
---
diff --git a/src/tests/headless-start-test.c b/src/tests/headless-start-test.c
index d21c73458..172a16544 100644
--- a/src/tests/headless-start-test.c
+++ b/src/tests/headless-start-test.c
@@ -32,6 +32,7 @@
 #include "wayland/meta-wayland.h"
 
 #define ALL_TRANSFORMS ((1 << (META_MONITOR_TRANSFORM_FLIPPED_270 + 1)) - 1)
+#define FRAME_WARNING "Frame has assigned frame counter but no frame drawn time"
 
 static gboolean
 run_tests (gpointer data)
@@ -40,6 +41,8 @@ run_tests (gpointer data)
   MetaSettings *settings = meta_backend_get_settings (backend);
   gboolean ret;
 
+  g_test_log_set_fatal_handler (NULL, NULL);
+
   meta_settings_override_experimental_features (settings);
 
   meta_settings_enable_experimental_feature (
@@ -53,6 +56,20 @@ run_tests (gpointer data)
   return FALSE;
 }
 
+static gboolean
+ignore_frame_counter_warning (const gchar    *log_domain,
+                              GLogLevelFlags  log_level,
+                              const gchar    *message,
+                              gpointer        user_data)
+{
+  if ((log_level & G_LOG_LEVEL_WARNING) &&
+      g_strcmp0 (log_domain, "mutter") == 0 &&
+      g_str_has_suffix (message, FRAME_WARNING))
+    return FALSE;
+
+  return TRUE;
+}
+
 static void
 meta_test_headless_start (void)
 {
@@ -193,6 +210,8 @@ main (int argc, char *argv[])
   meta_init ();
   meta_register_with_session ();
 
+  g_test_log_set_fatal_handler (ignore_frame_counter_warning, NULL);
+
   g_idle_add (run_tests, NULL);
 
   return meta_run ();


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