[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2] glib-compat: work around g_test_message bug
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH v2] glib-compat: work around g_test_message bug with subprocess tests |
Date: |
Fri, 30 Nov 2018 01:08:29 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 |
On 29/11/18 19:00, Paolo Bonzini wrote:
> Subprocesses are created by glib without leaving the file descriptors
> open. Therefore, g_test_message (and assertion failures, but those
> trigger when things are going bad anyway) will think that it is writing
> to the log file descriptor, but while actually stomping on the QMP
> file descriptor or similar. This causes spurious failures, which are
> as nice to debug as the reader can imagine. While I have opened a
> pull request on GLib, this will probably take a while to propagate
> to distros.
>
> I found this while working on qgraph, but the fix is generic.
This is not a problem anymore if we switch from gtester to tap. Do we
want it fixed anyway or not?
Paolo
> Signed-off-by: Paolo Bonzini <address@hidden>
> Message-Id: <address@hidden>
> Reviewed-by: Marc-André Lureau <address@hidden>
> Reviewed-by: Eric Blake <address@hidden>
> Signed-off-by: Paolo Bonzini <address@hidden>
> ---
> include/glib-compat.h | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/include/glib-compat.h b/include/glib-compat.h
> index fdf95a255d..f675c7328f 100644
> --- a/include/glib-compat.h
> +++ b/include/glib-compat.h
> @@ -113,4 +113,12 @@ gint g_poll_fixed(GPollFD *fds, guint nfds, gint
> timeout);
>
> #pragma GCC diagnostic pop
>
> +/* See https://gitlab.gnome.org/GNOME/glib/merge_requests/501 */
> +#define g_test_message(...) \
> + do { \
> + if (!g_test_subprocess()) { \
> + g_test_message(__VA_ARGS__); \
> + } \
> + } while (0)
> +
> #endif
>