Received: from eggs.gnu.org ([2001:4830:134:3::10]:56674) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btWoi-0002ne-Nx for qemu-devel@nongnu.org; Mon, 10 Oct 2016 05:24:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1btWod-0003gR-Eo for qemu-devel@nongnu.org; Mon, 10 Oct 2016 05:24:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39628) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btWod-0003g8-8U for qemu-devel@nongnu.org; Mon, 10 Oct 2016 05:24:11 -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 CDE503D944 for ; Mon, 10 Oct 2016 09:24:10 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Mon, 10 Oct 2016 13:22:55 +0400 Message-Id: <20161010092301.14974-19-marcandre.lureau@redhat.com> In-Reply-To: <20161010092301.14974-1-marcandre.lureau@redhat.com> References: <20161010092301.14974-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH 18/24] qtest: add qtest_init_qmp_caps() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: eblake@redhat.com, berrange@redhat.com, armbru@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Add a function to specify the qmp capabilities content. Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/libqtest.c | 13 +++++++++++-- tests/libqtest.h | 9 +++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/tests/libqtest.c b/tests/libqtest.c index 6f6bdf1..d672adb 100644 --- a/tests/libqtest.c +++ b/tests/libqtest.c @@ -146,7 +146,7 @@ void qtest_add_abrt_handler(GHookFunc fn, const void = *data) g_hook_prepend(&abrt_hooks, hook); } =20 -QTestState *qtest_init(const char *extra_args) +QTestState *qtest_init_qmp_caps(const char *extra_args, const char *qmp_= caps) { QTestState *s; int sock, qmpsock, i; @@ -203,7 +203,11 @@ QTestState *qtest_init(const char *extra_args) =20 /* Read the QMP greeting and then do the handshake */ qtest_qmp_discard_response(s, ""); - qtest_qmp_discard_response(s, "{ 'execute': 'qmp_capabilities' }"); + command =3D g_strdup_printf( + "{ 'execute': 'qmp_capabilities'," + " 'arguments': {'capabilities': [%s]}}", qmp_caps); + qtest_qmp_discard_response(s, command); + g_free(command); =20 if (getenv("QTEST_STOP")) { kill(s->qemu_pid, SIGSTOP); @@ -212,6 +216,11 @@ QTestState *qtest_init(const char *extra_args) return s; } =20 +QTestState *qtest_init(const char *extra_args) +{ + return qtest_init_qmp_caps(extra_args, ""); +} + void qtest_quit(QTestState *s) { qtest_instances =3D g_list_remove(qtest_instances, s); diff --git a/tests/libqtest.h b/tests/libqtest.h index f7402e0..bdec5de 100644 --- a/tests/libqtest.h +++ b/tests/libqtest.h @@ -31,6 +31,15 @@ extern QTestState *global_qtest; */ QTestState *qtest_init(const char *extra_args); =20 +/** + * qtest_init_qmp_caps: + * @extra_args: other arguments to pass to QEMU. + * @qmp_caps: qmp capabilities + * + * Returns: #QTestState instance. + */ +QTestState *qtest_init_qmp_caps(const char *extra_args, const char *qmp_= caps); + /** * qtest_quit: * @s: #QTestState instance to operate on. --=20 2.10.0