From nobody Sun Oct 26 00:02:45 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 1521615520068411.1596006066086; Tue, 20 Mar 2018 23:58:40 -0700 (PDT) Received: from localhost ([::1]:53205 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyXhn-0000de-Br for importer@patchew.org; Wed, 21 Mar 2018 02:58:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58150) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyXee-00073V-0Q for qemu-devel@nongnu.org; Wed, 21 Mar 2018 02:55:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyXed-0005il-1A for qemu-devel@nongnu.org; Wed, 21 Mar 2018 02:55:24 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:53110 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 1eyXec-0005iS-P9 for qemu-devel@nongnu.org; Wed, 21 Mar 2018 02:55:22 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 498B8F641F; Wed, 21 Mar 2018 06:55:22 +0000 (UTC) Received: from xz-mi.nay.redhat.com (dhcp-14-151.nay.redhat.com [10.66.14.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id 636911101E88; Wed, 21 Mar 2018 06:55:20 +0000 (UTC) From: Peter Xu To: qemu-devel@nongnu.org Date: Wed, 21 Mar 2018 14:55:06 +0800 Message-Id: <20180321065506.21091-4-peterx@redhat.com> In-Reply-To: <20180321065506.21091-1-peterx@redhat.com> References: <20180321065506.21091-1-peterx@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 21 Mar 2018 06:55:22 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 21 Mar 2018 06:55:22 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'peterx@redhat.com' RCPT:'' 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] [PATCH 3/3] tests: more strict command batching test 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: mdroth@linux.vnet.ibm.com, peterx@redhat.com, Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add "id" fields to the commands, and check that the command returns are in order. Signed-off-by: Peter Xu --- tests/qmp-test.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/qmp-test.c b/tests/qmp-test.c index 07c0b87e27..c861c3b550 100644 --- a/tests/qmp-test.c +++ b/tests/qmp-test.c @@ -83,6 +83,7 @@ static void test_qmp_protocol(void) const QListEntry *entry; QString *qstr; int i; + char buf[128]; =20 qts =3D qtest_init_without_qmp_handshake(common_args); =20 @@ -150,7 +151,10 @@ static void test_qmp_protocol(void) * best-effort test. */ for (i =3D 0; i < 16; i++) { - qtest_async_qmp(qts, "{ 'execute': 'query-version' }"); + snprintf(buf, sizeof(buf) - 1, "{ 'execute': 'query-version', " + "'id': %d }", i); + buf[sizeof(buf) - 1] =3D '\0'; + qtest_async_qmp(qts, buf); } /* Verify the replies to make sure no command is dropped. */ for (i =3D 0; i < 16; i++) { @@ -158,6 +162,8 @@ static void test_qmp_protocol(void) /* It should never be dropped. Each of them should be a reply. */ g_assert(qdict_haskey(resp, "return")); g_assert(!qdict_haskey(resp, "event")); + g_assert(qdict_haskey(resp, "id")); + g_assert(qdict_get_int(resp, "id") =3D=3D i); QDECREF(resp); } =20 --=20 2.14.3