From aec5d17d77002b6100562b4e2f03f7b6c3a9c78d Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 5 Apr 2022 18:19:23 +0100 Subject: [PATCH] tests: Remove an incorrect assertion in converter-stream MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- 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 31399a78e..b146cf43f 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) {