From patchwork Thu Oct 20 10:36:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dr. David Alan Gilbert" X-Patchwork-Id: 9386535 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0A0E2607D0 for ; Thu, 20 Oct 2016 10:37:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF16129B87 for ; Thu, 20 Oct 2016 10:37:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E313B29BC2; Thu, 20 Oct 2016 10:37:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_HK_NAME_DR autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 88E7429B87 for ; Thu, 20 Oct 2016 10:37:08 +0000 (UTC) Received: from localhost ([::1]:53692 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bxAih-0001x3-E7 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 20 Oct 2016 06:37:07 -0400 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 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E51CA3D94B; Thu, 20 Oct 2016 10:36:39 +0000 (UTC) Received: from dgilbert-t530.redhat.com ([10.33.36.2]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9KAab09026342; Thu, 20 Oct 2016 06:36:38 -0400 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, pbonzini@redhat.com, peter.maydell@linaro.org, armbru@redhat.com 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> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 20 Oct 2016 10:36:39 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 1/2] tests/stubs: Add a dummy, silent monitor X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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