[glib: 2/16] tests: Fix non-TAP output from debugcontroller test




commit f977ddf34f3973be8486ed664d4deef7b10d05ca
Author: Philip Withnall <pwithnall endlessos org>
Date:   Tue Jun 14 15:19:47 2022 +0100

    tests: Fix non-TAP output from debugcontroller test
    
    When running under a strict TAP parser this was previously producing
    problematic non-conforming output.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 gio/tests/debugcontroller.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
---
diff --git a/gio/tests/debugcontroller.c b/gio/tests/debugcontroller.c
index 01b8ebdef4..862e8f666c 100644
--- a/gio/tests/debugcontroller.c
+++ b/gio/tests/debugcontroller.c
@@ -383,6 +383,15 @@ test_dbus_properties (void)
   g_clear_object (&bus);
 }
 
+static GLogWriterOutput
+noop_log_writer_cb (GLogLevelFlags   log_level,
+                    const GLogField *fields,
+                    gsize            n_fields,
+                    gpointer         user_data)
+{
+  return G_LOG_WRITER_HANDLED;
+}
+
 int
 main (int   argc,
       char *argv[])
@@ -390,6 +399,10 @@ main (int   argc,
   setlocale (LC_ALL, "");
   g_test_init (&argc, &argv, NULL);
 
+  /* Ignore the log messages, as the debug controller prints one when debug is
+   * enabled/disabled, and if debug is enabled then that will escape to stdout. */
+  g_log_set_writer_func (noop_log_writer_cb, NULL, NULL);
+
   g_test_add_func ("/debug-controller/dbus/basic", test_dbus_basic);
   g_test_add_func ("/debug-controller/dbus/duplicate", test_dbus_duplicate);
   g_test_add_func ("/debug-controller/dbus/properties", test_dbus_properties);


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