[glib/wip/pwithnall/converter-stream-debugging: 7/7] tests: Remove an incorrect assertion in converter-stream




commit aec5d17d77002b6100562b4e2f03f7b6c3a9c78d
Author: Philip Withnall <pwithnall endlessos org>
Date:   Tue Apr 5 18:19:23 2022 +0100

    tests: Remove an incorrect assertion in converter-stream
    
    While the assertion always turned out to be true on Linux, it frequently
    caused spurious test failures on FreeBSD.
    
    After some remote debugging, I *think* the cause is as written up in the
    comment in the code in this commit. However, I cannot be certain, as the
    more debugging messages I added, the harder the failure was to
    reproduce; and I don’t have access to a FreeBSD machine.
    
    This fixes failures like:
    ```
    Bail out! GLib-GIO:ERROR:../gio/tests/converter-stream.c:1043:test_converter_pollable: assertion failed 
(error == NULL): Resource temporarily unavailable (g-io-error-quark, 27)
    ```
    
    It’s succeeded 1000 times in a row on the FreeBSD CI now; previously
    it was failing one time in three:
    https://gitlab.gnome.org/GNOME/glib/-/jobs/1936395.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 gio/tests/converter-stream.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/gio/tests/converter-stream.c b/gio/tests/converter-stream.c
index 31399a78ea..b146cf43fc 100644
--- a/gio/tests/converter-stream.c
+++ b/gio/tests/converter-stream.c
@@ -1037,12 +1037,11 @@ test_converter_pollable (void)
       if (!is_readable)
        g_assert_cmpint (res, ==, -1);
 
-      /* After closing the write end, we can't get WOULD_BLOCK any more */
-      if (!socket_out)
-        {
-          g_assert_no_error (error);
-          g_assert_cmpint (res, !=, -1);
-        }
+      /* Even after closing the write end, we can get WOULD_BLOCK (particularly
+       * on FreeBSD), so we can’t make any assertions based on `!socket_out`.
+       * This is because the FIN packets may still be in the out buffer of one
+       * half of the socket pair, while the in buffer of the other half has some
+       * data, but not enough for a full block for the converter to consume. */
 
       if (res == -1)
        {


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