[glib/wip/pwithnall/converter-stream-debugging] WIP: debugging converter-stream test




commit 94870d7b3a04c0f7c008a931632e3e43b88e08dc
Author: Philip Withnall <pwithnall endlessos org>
Date:   Tue Apr 5 15:04:45 2022 +0100

    WIP: debugging converter-stream test
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 gio/tests/converter-stream.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/gio/tests/converter-stream.c b/gio/tests/converter-stream.c
index 31399a78ea..6ba741186e 100644
--- a/gio/tests/converter-stream.c
+++ b/gio/tests/converter-stream.c
@@ -1002,22 +1002,31 @@ test_converter_pollable (void)
   total_read = 0;
   outptr = expanded;
   inptr = converted;
+
+  g_test_message ("Starting loop");
+
   while (TRUE)
     {
       error = NULL;
 
+      g_test_message ("Starting loop iteration");
+
       if (outptr < expanded_end)
        {
           res = g_output_stream_write (socket_out,
                                       outptr,
                                       MIN (1000, (expanded_end - outptr)),
                                       NULL, &error);
+          g_test_message ("Wrote %ld bytes; now expanded_end - outptr = %lu",
+                          res, expanded_end - outptr);
          g_assert_cmpint (res, >, 0);
          outptr += res;
        }
       else if (socket_out)
        {
-         g_output_stream_close (socket_out, NULL, NULL);
+         g_output_stream_close (socket_out, NULL, &error);
+          g_assert_no_error (error);
+          g_test_message ("Closed socket_out");
          g_object_unref (right);
          socket_out = NULL;
        }
@@ -1026,12 +1035,19 @@ test_converter_pollable (void)
        * write. We can’t wait on a GSource as that might affect the stream under
        * test, so just poll. */
       while (!g_pollable_input_stream_is_readable (pollable_in))
-        g_usleep (80L);
+        {
+          g_test_message ("pollable_in is not readable; sleeping");
+          g_usleep (80L);
+        }
 
       is_readable = g_pollable_input_stream_is_readable (pollable_in);
+      g_test_message ("pollable_in is %s", is_readable ? "readable" : "not readable");
       res = g_pollable_input_stream_read_nonblocking (pollable_in,
                                                      inptr, 1,
                                                      NULL, &error);
+      g_test_message ("read %ld bytes", res);
+      if (error != NULL)
+        g_test_message ("Got error %s", error->message);
 
       /* is_readable can be a false positive, but not a false negative */
       if (!is_readable)


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