From nobody Fri Dec 19 17:34:40 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1501810563137559.4478024669141; Thu, 3 Aug 2017 18:36:03 -0700 (PDT) Received: from localhost ([::1]:43488 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ddRWz-00079f-Pv for importer@patchew.org; Thu, 03 Aug 2017 21:36:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60447) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ddRNl-00007g-9Z for qemu-devel@nongnu.org; Thu, 03 Aug 2017 21:26:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ddRNk-0004Yv-78 for qemu-devel@nongnu.org; Thu, 03 Aug 2017 21:26:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54040) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ddRNj-0004WO-Ur for qemu-devel@nongnu.org; Thu, 03 Aug 2017 21:26:28 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E6C0361474 for ; Fri, 4 Aug 2017 01:26:26 +0000 (UTC) Received: from red.redhat.com (ovpn-121-23.rdu2.redhat.com [10.10.121.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5BA0761F36; Fri, 4 Aug 2017 01:26:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E6C0361474 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=eblake@redhat.com From: Eric Blake To: qemu-devel@nongnu.org Date: Thu, 3 Aug 2017 20:25:50 -0500 Message-Id: <20170804012551.2714-22-eblake@redhat.com> In-Reply-To: <20170804012551.2714-1-eblake@redhat.com> References: <20170804012551.2714-1-eblake@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 04 Aug 2017 01:26:27 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v4 21/22] libqtest: Drop now-unused qmp() 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: , Cc: armbru@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" All callers have been converted to a form of qmp_cmd() or qmp_args() that takes the command name with less boilerplate. Therefore, we also know that all commands are using interpolation, and can remove an assertion. This also means that we have fixed the testsuite to comply with -Wformat checking on the strings being interpolated for qmp() (similar to what we previously did for strings used in hmp(), and matching the checking present on qobject_from_jsonf()). Signed-off-by: Eric Blake --- tests/libqtest.h | 20 +------------------- tests/libqtest.c | 32 ++++---------------------------- 2 files changed, 5 insertions(+), 47 deletions(-) diff --git a/tests/libqtest.h b/tests/libqtest.h index 193adf1eb9..04b36a7b11 100644 --- a/tests/libqtest.h +++ b/tests/libqtest.h @@ -457,15 +457,6 @@ static inline void qtest_end(void) } /** - * qmp: - * @fmt...: QMP message to send to qemu; formats arguments through - * json-lexer.c (only understands '%(PRI[ud]64|(l|ll)?[du]|[ipsf%])'). - * - * Sends a QMP message to QEMU and returns the response. - */ -QDict *qmp(const char *fmt, ...); - -/** * qmp_raw: * @msg: Raw QMP message to send to qemu. * @@ -474,15 +465,6 @@ QDict *qmp(const char *fmt, ...); QDict *qmp_raw(const char *msg); /** - * qmp_async: - * @fmt...: QMP message to send to qemu; formats arguments through - * json-lexer.c (only understands '%(PRI[ud]64|(l|ll)?[du]|[ipsf%])'). - * - * Sends a QMP message to QEMU and leaves the response in the stream. - */ -void qmp_async(const char *fmt, ...); - -/** * qmp_cmd: * @cmd: QMP command, with no arguments. * @@ -530,7 +512,7 @@ void qmp_args_async(const char *cmd, const char *fmt, .= ..) GCC_FMT_ATTR(2, 3); /** * qmp_discard_response: * - * Read and discard a QMP response, typically after qmp_async(). + * Read and discard a QMP response, typically after qmp_cmd_async(). */ void qmp_discard_response(void); diff --git a/tests/libqtest.c b/tests/libqtest.c index 5012ecf929..4597d4ac66 100644 --- a/tests/libqtest.c +++ b/tests/libqtest.c @@ -453,17 +453,12 @@ static void qtest_qmp_sendv(QTestState *s, const char= *fmt, va_list ap) QString *qstr; const char *str; - assert(strstr(fmt, "execute")); - /* - * A round trip through QObject is only needed if % interpolation - * is used. We interpolate through QObject rather than sprintf in - * order to escape strings properly. + * A round trip through QObject (and not sprintf) is needed + * because % interpolation is used, and we must escape strings + * properly. */ - if (!strchr(fmt, '%')) { - qmp_fd_send(s->qmp_fd, fmt); - return; - } + assert(strchr(fmt, '%')); qobj =3D qobject_from_jsonv(fmt, ap); qstr =3D qobject_to_json(qobj); @@ -833,31 +828,12 @@ void qtest_memset(QTestState *s, uint64_t addr, uint8= _t pattern, size_t size) qtest_rsp(s, 0); } -QDict *qmp(const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - qtest_qmp_sendv(global_qtest, fmt, ap); - va_end(ap); - return qtest_qmp_receive(global_qtest); -} - QDict *qmp_raw(const char *msg) { qmp_fd_send(global_qtest->qmp_fd, msg); return qtest_qmp_receive(global_qtest); } -void qmp_async(const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - qtest_qmp_sendv(global_qtest, fmt, ap); - va_end(ap); -} - QDict *qmp_cmd(const char *cmd) { qmp_cmd_async(cmd); --=20 2.13.3