[glib/wip/pwithnall/more-test-fixes: 2/2] tests: Explicitly close stream in converter-stream




commit e37d85505ede4fdf18a7bea804aa18a75a5332b2
Author: Philip Withnall <pwithnall endlessos org>
Date:   Mon Mar 14 16:37:41 2022 +0000

    tests: Explicitly close stream in converter-stream
    
    When the test has finished writing all the expanded content into the
    socket, explicitly close the output stream, which should make the input
    stream readable and non-blocking.
    
    The code intended to do this before, but only as a side-effect of
    dropping its last reference to `right`. If another reference was being
    held to `right` somewhere else, it wouldn’t end up being closed, which
    would lead to failures like
    https://gitlab.gnome.org/GNOME/glib/-/jobs/1890000:
    ```
    (/var/tmp/gitlab_runner/builds/Ff4WDDRj/0/GNOME/glib/_build/gio/tests/converter-stream:56570): 
GLib-GIO-DEBUG: 12:56:23.280: GSocketClient: Connection successful!
    Bail out! GLib-GIO:ERROR:../gio/tests/converter-stream.c:1042:test_converter_pollable: assertion failed 
(error == NULL): Resource temporarily unavailable (g-io-error-quark, 27)
    stderr:
    ```
    
    This is a bit of a guess (I’m not sure it’ll fix the intermittent test
    error, as I haven’t been able to reproduce that locally), but it’s worth
    a try.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 gio/tests/converter-stream.c | 1 +
 1 file changed, 1 insertion(+)
---
diff --git a/gio/tests/converter-stream.c b/gio/tests/converter-stream.c
index b23436d8f..31399a78e 100644
--- a/gio/tests/converter-stream.c
+++ b/gio/tests/converter-stream.c
@@ -1017,6 +1017,7 @@ test_converter_pollable (void)
        }
       else if (socket_out)
        {
+         g_output_stream_close (socket_out, NULL, NULL);
          g_object_unref (right);
          socket_out = NULL;
        }


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