All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] glib-compat: work around g_test_message bug with subprocess tests
@ 2018-11-27 18:35 Paolo Bonzini
  2018-11-27 18:44 ` Eric Blake
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Paolo Bonzini @ 2018-11-27 18:35 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marc-André Lureau

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.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/glib-compat.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/include/glib-compat.h b/include/glib-compat.h
index fdf95a2..989b9ef 100644
--- a/include/glib-compat.h
+++ b/include/glib-compat.h
@@ -113,4 +113,10 @@ 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
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-11-29 13:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-27 18:35 [Qemu-devel] [PATCH] glib-compat: work around g_test_message bug with subprocess tests Paolo Bonzini
2018-11-27 18:44 ` Eric Blake
2018-11-27 18:58   ` Paolo Bonzini
2018-11-29 13:38   ` [Qemu-devel] [Qemu-devel for-3.1?] " Eric Blake
2018-11-27 18:49 ` [Qemu-devel] " Marc-André Lureau
2018-11-27 18:55   ` Paolo Bonzini
2018-11-29 11:57 ` no-reply

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.