From dbe34687d0f3ed02e249b3ccb98ee51160ea66ed Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 14 Mar 2022 16:04:29 +0000 Subject: [PATCH 1/2] tests: Skip vasprintf() placeholder checks on FreeBSD and macOS The `vasprintf()` version on those platforms seems to do less rigorous checking of format placeholders. See https://gitlab.gnome.org/GNOME/glib/-/jobs/1890001 and https://gitlab.gnome.org/GNOME/glib/-/jobs/1890000. Signed-off-by: Philip Withnall --- glib/tests/test-printf.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/glib/tests/test-printf.c b/glib/tests/test-printf.c index 77eb76a4a..6eadf1e98 100644 --- a/glib/tests/test-printf.c +++ b/glib/tests/test-printf.c @@ -895,6 +895,7 @@ test_upper_bound (void) g_assert_cmpint (res, ==, 20); } +#if !defined(__APPLE__) && !defined(__FreeBSD__) static gint test_vasprintf_va (gchar **string, const gchar *format, ...) G_GNUC_PRINTF (2, 3); @@ -914,15 +915,19 @@ test_vasprintf_va (gchar **string, return len; } +#endif /* !defined(__APPLE__) && !defined(__FreeBSD__) */ static void test_vasprintf_invalid_format_placeholder (void) { +#if !defined(__APPLE__) && !defined(__FreeBSD__) gint len = 0; gchar *buf = "some non-null string"; +#endif g_test_summary ("Test error handling for invalid format placeholder in g_vasprintf()"); +#if !defined(__APPLE__) && !defined(__FreeBSD__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat" #pragma GCC diagnostic ignored "-Wformat-extra-args" @@ -931,6 +936,9 @@ test_vasprintf_invalid_format_placeholder (void) g_assert_cmpint (len, ==, -1); g_assert_null (buf); +#else + g_test_skip ("vasprintf() placeholder checks on BSDs are less strict"); +#endif } int From 96caca2b7ab8d75b161f9c18736a4e9985cdc20e Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 14 Mar 2022 16:37:41 +0000 Subject: [PATCH 2/2] tests: Explicitly close stream in converter-stream MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- 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; }