[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 04/30] tests: send error_report to test log
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 04/30] tests: send error_report to test log |
Date: |
Tue, 1 Nov 2016 17:29:17 +0100 |
Implement error_vprintf to send the output of error_report to
the test log. This silences test-vmstate.
Signed-off-by: Paolo Bonzini <address@hidden>
Message-Id: <address@hidden>
---
include/glib-compat.h | 13 +++++++++++++
stubs/error-printf.c | 8 +++++++-
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/include/glib-compat.h b/include/glib-compat.h
index 3f8370b..acf254d 100644
--- a/include/glib-compat.h
+++ b/include/glib-compat.h
@@ -315,4 +315,17 @@ static inline void g_source_set_name_by_id(guint tag,
const char *name)
}
#endif
+#if !GLIB_CHECK_VERSION(2, 36, 0)
+/* Always fail. This will not include error_report output in the test log,
+ * sending it instead to stderr.
+ */
+#define g_test_initialized() (0)
+#endif
+#if !GLIB_CHECK_VERSION(2, 38, 0)
+#ifdef CONFIG_HAS_GLIB_SUBPROCESS_TESTS
+#error schizophrenic detection of glib subprocess testing
+#endif
+#define g_test_subprocess() (0)
+#endif
+
#endif
diff --git a/stubs/error-printf.c b/stubs/error-printf.c
index 56379e6..ac6b92a 100644
--- a/stubs/error-printf.c
+++ b/stubs/error-printf.c
@@ -4,7 +4,13 @@
void error_vprintf(const char *fmt, va_list ap)
{
- vfprintf(stderr, fmt, ap);
+ if (g_test_initialized() && !g_test_subprocess()) {
+ char *msg = g_strdup_vprintf(fmt, ap);
+ g_test_message("%s", msg);
+ g_free(msg);
+ } else {
+ vfprintf(stderr, fmt, ap);
+ }
}
void error_vprintf_unless_qmp(const char *fmt, va_list ap)
--
2.7.4
- [Qemu-devel] [PULL v2 00/30] Misc patches for 2016-10-31, Paolo Bonzini, 2016/11/01
- [Qemu-devel] [PULL 01/30] checkpatch: tweak "struct should normally be const" warning, Paolo Bonzini, 2016/11/01
- [Qemu-devel] [PULL 02/30] nbd: Use CoQueue for free_sema instead of CoMutex, Paolo Bonzini, 2016/11/01
- [Qemu-devel] [PULL 04/30] tests: send error_report to test log,
Paolo Bonzini <=
- [Qemu-devel] [PULL 03/30] qemu-error: remove dependency of stubs on monitor, Paolo Bonzini, 2016/11/01
- [Qemu-devel] [PULL 05/30] exec.c: ensure all AddressSpaceDispatch updates under RCU, Paolo Bonzini, 2016/11/01
- [Qemu-devel] [PULL 07/30] exec.c: check memory backend file size with 'size' option, Paolo Bonzini, 2016/11/01
- [Qemu-devel] [PULL 06/30] exec.c: do not truncate non-empty memory backend file, Paolo Bonzini, 2016/11/01
- [Qemu-devel] [PULL 08/30] nbd: Add qemu-nbd -D for human-readable description, Paolo Bonzini, 2016/11/01
- [Qemu-devel] [PULL 10/30] nbd: Rename NBDRequest to NBDRequestData, Paolo Bonzini, 2016/11/01
- [Qemu-devel] [PULL 09/30] nbd: Treat flags vs. command type as separate fields, Paolo Bonzini, 2016/11/01
- [Qemu-devel] [PULL 13/30] nbd: Share common reply-sending code in server, Paolo Bonzini, 2016/11/01
- [Qemu-devel] [PULL 11/30] nbd: Rename NbdClientSession to NBDClientSession, Paolo Bonzini, 2016/11/01
- [Qemu-devel] [PULL 14/30] nbd: Send message along with server NBD_REP_ERR errors, Paolo Bonzini, 2016/11/01