glib-compat: work around g_test_message bug with subprocess tests
PATCH v2 1/1 glib-compat: work around g_test_message bug with subprocess tests
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.
Message-Id: <[email protected]>
--- include/glib-compat.h | 8 ++++++++ 1 file changed, 8 insertions(+)
include/glib-compat.h +8 -0
@@ -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
Signature · 1 line
2.19.1
Quoted 10 lines · Paolo Bonzini
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
Quoted 27 lines
Signed-off-by Paolo Bonzini <[email protected]>Message-Id: <[email protected]>
Reviewed-by Marc-André Lureau <[email protected]>Reviewed-by Eric Blake <[email protected]>Signed-off-by Paolo Bonzini <[email protected]>--- include/glib-compat.h | 8 ++++++++ 1 file changed, 8 insertions(+)include/glib-compat.h +8
-0@@ -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
Quoted 10 lines · Paolo Bonzini
Quoted 9 lines · Paolo Bonzini
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.
Quoted 4 lines
Quoted 1 line
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?
If there is no -rc4, I'm fine if we drop this patch in favor of your other patches for TAP. But if we have -rc4, this may still be useful for inclusion in 3.1 for testsuite robustness.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Quoted 10 lines · Paolo Bonzini
Quoted 9 lines · Paolo Bonzini
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.
Quoted 4 lines
Quoted 1 line
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?
IMHO the change to tap is not really something we shoudl be doing at this point in the release cycle. So I'd favour taking this fix for 3.1, even if it becomes redundant when we switch to tap in 4.0
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Quoted 11 lines · Daniel P. Berrangé
Quoted 10 lines · Paolo Bonzini
Quoted 9 lines · Paolo Bonzini
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.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
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?
IMHO the change to tap is not really something we shoudl be doing at this point in the release cycle.
Of course---I wasn't suggesting that, the TAP switch is for 4.0. However, this fix is not needed for 3.1 as far as I know, and we're pretty late in 3.1's rc period too.
Paolo
Quoted 2 lines
So I'd favour taking this fix
for 3.1, even if it becomes redundant when we switch to tap in 4.0