From patchwork Wed Jan 24 05:39:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 865205 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zRDym3wr6z9s74 for ; Wed, 24 Jan 2018 16:59:44 +1100 (AEDT) Received: from localhost ([::1]:53101 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eeE62-0007YM-IL for incoming@patchwork.ozlabs.org; Wed, 24 Jan 2018 00:59:42 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56604) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eeDqE-0003G2-48 for qemu-devel@nongnu.org; Wed, 24 Jan 2018 00:43:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eeDqD-0001Tz-6e for qemu-devel@nongnu.org; Wed, 24 Jan 2018 00:43:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36344) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eeDqD-0001Sy-0L for qemu-devel@nongnu.org; Wed, 24 Jan 2018 00:43:21 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2715981DE4; Wed, 24 Jan 2018 05:43:20 +0000 (UTC) Received: from xz-mi.redhat.com (ovpn-12-154.pek2.redhat.com [10.72.12.154]) by smtp.corp.redhat.com (Postfix) with ESMTP id 868976A941; Wed, 24 Jan 2018 05:43:12 +0000 (UTC) From: Peter Xu To: qemu-devel@nongnu.org Date: Wed, 24 Jan 2018 13:39:56 +0800 Message-Id: <20180124053957.29145-23-peterx@redhat.com> In-Reply-To: <20180124053957.29145-1-peterx@redhat.com> References: <20180124053957.29145-1-peterx@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 24 Jan 2018 05:43:20 +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 v7 22/23] 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" OOB introduced DROP event for flow control. This should not affect old QMP clients. Add a command batching check to make sure of it. Reviewed-by: Stefan Hajnoczi Signed-off-by: Peter Xu --- tests/qmp-test.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/qmp-test.c b/tests/qmp-test.c index 11b384c829..19fa774486 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,27 @@ 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. Note: this test does not control the + * scheduling of QEMU's QMP command processing threads so it may + * not really trigger batching inside QEMU. This is just a + * best-effort test. + */ + 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(); }