From patchwork Thu Nov 16 13:06:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 10061145 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 69E7F60230 for ; Thu, 16 Nov 2017 13:26:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B20C2AA2D for ; Thu, 16 Nov 2017 13:26:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 502C32AA31; Thu, 16 Nov 2017 13:26:45 +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 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 EDD9B2AA2D for ; Thu, 16 Nov 2017 13:26:44 +0000 (UTC) Received: from localhost ([::1]:40871 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFKBo-0007Lb-4v for patchwork-qemu-devel@patchwork.kernel.org; Thu, 16 Nov 2017 08:26:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39571) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFJue-0001Ai-DF for qemu-devel@nongnu.org; Thu, 16 Nov 2017 08:09:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFJud-0001fh-HW for qemu-devel@nongnu.org; Thu, 16 Nov 2017 08:09:00 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52459) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eFJud-0001dt-Bg for qemu-devel@nongnu.org; Thu, 16 Nov 2017 08:08:59 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9D8E5C03BD72; Thu, 16 Nov 2017 13:08:58 +0000 (UTC) Received: from xz-mi.nay.redhat.com (dhcp-14-111.nay.redhat.com [10.66.14.111]) by smtp.corp.redhat.com (Postfix) with ESMTP id ABE6160560; Thu, 16 Nov 2017 13:08:54 +0000 (UTC) From: Peter Xu To: qemu-devel@nongnu.org Date: Thu, 16 Nov 2017 21:06:09 +0800 Message-Id: <20171116130610.23582-27-peterx@redhat.com> In-Reply-To: <20171116130610.23582-1-peterx@redhat.com> References: <20171116130610.23582-1-peterx@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 16 Nov 2017 13:08:58 +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] [RFC v4 26/27] tests: qmp-test: verify command batching 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: Laurent Vivier , Fam Zheng , Juan Quintela , mdroth@linux.vnet.ibm.com, peterx@redhat.com, Markus Armbruster , marcandre.lureau@redhat.com, Stefan Hajnoczi , Paolo Bonzini , "Dr . David Alan Gilbert" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP OOB introduced DROP event for flow control. This should not affect old QMP clients. Add a command batching check to make sure of it. Signed-off-by: Peter Xu --- 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(); }