From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47059) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bxAiK-0001wa-13 for qemu-devel@nongnu.org; Thu, 20 Oct 2016 06:36:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bxAiG-00051y-RG for qemu-devel@nongnu.org; Thu, 20 Oct 2016 06:36:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39834) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bxAiG-00051h-Lb for qemu-devel@nongnu.org; Thu, 20 Oct 2016 06:36:40 -0400 From: "Dr. David Alan Gilbert (git)" Date: Thu, 20 Oct 2016 11:36:35 +0100 Message-Id: <20161020103636.22228-2-dgilbert@redhat.com> In-Reply-To: <20161020103636.22228-1-dgilbert@redhat.com> References: <20161020103636.22228-1-dgilbert@redhat.com> Subject: [Qemu-devel] [PATCH 1/2] tests/stubs: Add a dummy, silent monitor List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, pbonzini@redhat.com, peter.maydell@linaro.org, armbru@redhat.com From: "Dr. David Alan Gilbert" 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 --- 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