From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50092) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eBe4C-00078L-6m for qemu-devel@nongnu.org; Mon, 06 Nov 2017 04:51:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eBe4A-0005h8-AX for qemu-devel@nongnu.org; Mon, 06 Nov 2017 04:51:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35348) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eBe4A-0005gt-4H for qemu-devel@nongnu.org; Mon, 06 Nov 2017 04:51:38 -0500 From: Peter Xu Date: Mon, 6 Nov 2017 17:46:42 +0800 Message-Id: <20171106094643.14881-27-peterx@redhat.com> In-Reply-To: <20171106094643.14881-1-peterx@redhat.com> References: <20171106094643.14881-1-peterx@redhat.com> Subject: [Qemu-devel] [RFC v3 26/27] tests: qmp-test: verify command batching List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi , "Daniel P . Berrange" , Paolo Bonzini , Fam Zheng , Jiri Denemark , Juan Quintela , mdroth@linux.vnet.ibm.com, peterx@redhat.com, Eric Blake , Laurent Vivier , marcandre.lureau@redhat.com, Markus Armbruster , "Dr . David Alan Gilbert" OOB introduced DROP event for flow control. This should not affect old QMP clients. Add a command batching check to make sure of it. --- tests/qmp-test.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/qmp-test.c b/tests/qmp-test.c index 292c5f135a..729ec59b0a 100644 --- a/tests/qmp-test.c +++ b/tests/qmp-test.c @@ -78,6 +78,7 @@ static void test_qmp_protocol(void) QList *capabilities; const QListEntry *entry; QString *qstr; + int i; global_qtest = qtest_init_without_qmp_handshake(common_args); @@ -135,6 +136,24 @@ static void test_qmp_protocol(void) g_assert_cmpint(qdict_get_int(resp, "id"), ==, 2); QDECREF(resp); + /* + * Test command batching. In current test OOB is not enabled, we + * should be able to run as many commands in batch as we like. + * Using 16 (>8, which is OOB queue length) to make sure OOB + * won't break existing clients. + */ + for (i = 0; i < 16; i++) { + qmp_async("{ 'execute': 'query-version' }"); + } + /* Verify the replies to make sure no command is dropped. */ + for (i = 0; i < 16; i++) { + resp = qmp_receive(); + /* It should never be dropped. Each of them should be a reply. */ + g_assert(qdict_haskey(resp, "return")); + g_assert(!qdict_haskey(resp, "event")); + QDECREF(resp); + } + qtest_end(); } -- 2.13.5