From nobody Sun Oct 5 19:09:41 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1522161452644507.0342560547898; Tue, 27 Mar 2018 07:37:32 -0700 (PDT) Received: from localhost ([::1]:34648 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0pj9-0004ab-R5 for importer@patchew.org; Tue, 27 Mar 2018 10:37:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49272) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0pcP-0007V8-80 for qemu-devel@nongnu.org; Tue, 27 Mar 2018 10:30:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0pcO-0004zp-20 for qemu-devel@nongnu.org; Tue, 27 Mar 2018 10:30:33 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:59408 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f0pcN-0004zF-TZ for qemu-devel@nongnu.org; Tue, 27 Mar 2018 10:30:31 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8BCDAEB6F4 for ; Tue, 27 Mar 2018 14:30:31 +0000 (UTC) Received: from red.redhat.com (ovpn-121-135.rdu2.redhat.com [10.10.121.135]) by smtp.corp.redhat.com (Postfix) with ESMTP id 36E5276C0; Tue, 27 Mar 2018 14:30:31 +0000 (UTC) From: Eric Blake To: qemu-devel@nongnu.org Date: Tue, 27 Mar 2018 09:30:12 -0500 Message-Id: <20180327143014.1767669-13-eblake@redhat.com> In-Reply-To: <20180327143014.1767669-1-eblake@redhat.com> References: <20180327143014.1767669-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 27 Mar 2018 14:30:31 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 27 Mar 2018 14:30:31 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'eblake@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 12/14] tests: Add parameter to qtest_init_without_qmp_handshake 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: Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Allow callers to choose whether to allow OOB support during a test; for now, all existing callers pass false, but the next patch will add a new caller. Also, rewrite the monitor setup to be generic (using the -qmp shorthand is insufficient for honoring the parameter). Based on an idea by Peter Xu, in <20180326063901.27425-8-peterx@redhat.com> Signed-off-by: Eric Blake Message-Id: <20180327013620.1644387-4-eblake@redhat.com> Tested-by: Christian Borntraeger Acked-by: Peter Xu Reviewed-by: Marc-Andr=C3=A9 Lureau --- tests/libqtest.h | 7 +++++-- tests/libqtest.c | 10 ++++++---- tests/qmp-test.c | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/tests/libqtest.h b/tests/libqtest.h index 811169453ab..cbe8df44730 100644 --- a/tests/libqtest.h +++ b/tests/libqtest.h @@ -56,11 +56,14 @@ QTestState *qtest_init(const char *extra_args); /** * qtest_init_without_qmp_handshake: - * @extra_args: other arguments to pass to QEMU. + * @use_oob: true to have the server advertise OOB support + * @extra_args: other arguments to pass to QEMU. CAUTION: these + * arguments are subject to word splitting and shell evaluation. * * Returns: #QTestState instance. */ -QTestState *qtest_init_without_qmp_handshake(const char *extra_args); +QTestState *qtest_init_without_qmp_handshake(bool use_oob, + const char *extra_args); /** * qtest_quit: diff --git a/tests/libqtest.c b/tests/libqtest.c index 200b2b9e92a..6f33a37667c 100644 --- a/tests/libqtest.c +++ b/tests/libqtest.c @@ -166,7 +166,8 @@ static const char *qtest_qemu_binary(void) return qemu_bin; } -QTestState *qtest_init_without_qmp_handshake(const char *extra_args) +QTestState *qtest_init_without_qmp_handshake(bool use_oob, + const char *extra_args) { QTestState *s; int sock, qmpsock, i; @@ -199,12 +200,13 @@ QTestState *qtest_init_without_qmp_handshake(const ch= ar *extra_args) command =3D g_strdup_printf("exec %s " "-qtest unix:%s,nowait " "-qtest-log %s " - "-qmp unix:%s,nowait " + "-chardev socket,path=3D%s,nowait,id=3Dc= har0 " + "-mon chardev=3Dchar0,mode=3Dcontrol%s " "-machine accel=3Dqtest " "-display none " "%s", qemu_binary, socket_path, getenv("QTEST_LOG") ? "/dev/fd/2" : "/de= v/null", - qmp_socket_path, + qmp_socket_path, use_oob ? ",x-oob=3Don"= : "", extra_args ?: ""); execlp("/bin/sh", "sh", "-c", command, NULL); exit(1); @@ -239,7 +241,7 @@ QTestState *qtest_init_without_qmp_handshake(const char= *extra_args) QTestState *qtest_init(const char *extra_args) { - QTestState *s =3D qtest_init_without_qmp_handshake(extra_args); + QTestState *s =3D qtest_init_without_qmp_handshake(false, extra_args); /* Read the QMP greeting and then do the handshake */ qtest_qmp_discard_response(s, ""); diff --git a/tests/qmp-test.c b/tests/qmp-test.c index 8de99a4727e..2134d95db97 100644 --- a/tests/qmp-test.c +++ b/tests/qmp-test.c @@ -81,7 +81,7 @@ static void test_qmp_protocol(void) QList *capabilities; QTestState *qts; - qts =3D qtest_init_without_qmp_handshake(common_args); + qts =3D qtest_init_without_qmp_handshake(false, common_args); /* Test greeting */ resp =3D qtest_qmp_receive(qts); --=20 2.14.3