[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 1/2] tests/stubs: Add a dummy, silent monitor
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[Qemu-devel] [PATCH 1/2] tests/stubs: Add a dummy, silent monitor |
Date: |
Thu, 20 Oct 2016 11:36:35 +0100 |
From: "Dr. David Alan Gilbert" <address@hidden>
We need an easy way to silence error_report's that come
up in meant-to-fail test cases. The easiest way to do
that is to create a monitor instance, and since our stubbed
monitor_printf's are slent this causes the errors to disappear.
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
---
stubs/mon-is-qmp.c | 9 +++++++++
tests/libqtest.h | 1 +
2 files changed, 10 insertions(+)
diff --git a/stubs/mon-is-qmp.c b/stubs/mon-is-qmp.c
index a8344ce..012eb28 100644
--- a/stubs/mon-is-qmp.c
+++ b/stubs/mon-is-qmp.c
@@ -2,7 +2,16 @@
#include "qemu-common.h"
#include "monitor/monitor.h"
+/* Monitor is defined internally to the real monitor.c, so
+ * it's real contents are never accessed when stubs are in use;
+ * just a pointer.
+ */
+struct Monitor {
+ int dummy;
+};
+
Monitor *cur_mon;
+Monitor stubs_silent_monitor;
bool monitor_cur_is_qmp(void)
{
diff --git a/tests/libqtest.h b/tests/libqtest.h
index 4be1f77..be34dbb 100644
--- a/tests/libqtest.h
+++ b/tests/libqtest.h
@@ -897,4 +897,5 @@ void qmp_fd_send(int fd, const char *fmt, ...);
QDict *qmp_fdv(int fd, const char *fmt, va_list ap);
QDict *qmp_fd(int fd, const char *fmt, ...);
+extern Monitor stubs_silent_monitor;
#endif
--
2.9.3