From nobody Wed Nov 5 18:34:59 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 1536128893019402.18022284773565; Tue, 4 Sep 2018 23:28:13 -0700 (PDT) Received: from localhost ([::1]:54021 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fxRIS-0001lh-1y for importer@patchew.org; Wed, 05 Sep 2018 02:28:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37900) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fxREr-0007Bz-Ld for qemu-devel@nongnu.org; Wed, 05 Sep 2018 02:24:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fxREp-0008Cz-MW for qemu-devel@nongnu.org; Wed, 05 Sep 2018 02:24:29 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:57446 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 1fxREn-0007f7-0x for qemu-devel@nongnu.org; Wed, 05 Sep 2018 02:24:27 -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 12BD840216E8 for ; Wed, 5 Sep 2018 06:24:07 +0000 (UTC) Received: from xz-x1.redhat.com (ovpn-12-80.pek2.redhat.com [10.72.12.80]) by smtp.corp.redhat.com (Postfix) with ESMTP id 225F6101041D; Wed, 5 Sep 2018 06:23:57 +0000 (UTC) From: Peter Xu To: qemu-devel@nongnu.org Date: Wed, 5 Sep 2018 14:23:13 +0800 Message-Id: <20180905062313.4059-7-peterx@redhat.com> In-Reply-To: <20180905062313.4059-1-peterx@redhat.com> References: <20180905062313.4059-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.5]); Wed, 05 Sep 2018 06:24:07 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 05 Sep 2018 06:24:07 +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] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v8 6/6] tests: qmp-test: add queue full 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: "Dr . David Alan Gilbert" , peterx@redhat.com, Markus Armbruster , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We'll need to include "monitor/monitor.h" for the queue length macro, then we don't need to hard code it. Suggested-by: Markus Armbruster Signed-off-by: Peter Xu Reviewed-by: Marc-Andr=C3=A9 Lureau --- tests/qmp-test.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/qmp-test.c b/tests/qmp-test.c index 91a90d1c9d..9e523a1806 100644 --- a/tests/qmp-test.c +++ b/tests/qmp-test.c @@ -18,6 +18,7 @@ #include "qapi/qmp/qlist.h" #include "qapi/qobject-input-visitor.h" #include "qapi/qmp/qstring.h" +#include "monitor/monitor.h" =20 const char common_args[] =3D "-nodefaults -machine none"; =20 @@ -248,6 +249,8 @@ static void test_qmp_oob(void) const QListEntry *entry; QList *capabilities; QString *qstr; + gchar *id; + int i; =20 qts =3D qtest_init_without_qmp_handshake(common_args); =20 @@ -302,6 +305,29 @@ static void test_qmp_oob(void) unblock_blocked_cmd(); recv_cmd_id(qts, "blocks-2"); recv_cmd_id(qts, "err-2"); + + /* + * Test queue full. When that happens, the out-of-band command + * will only be able to be handled after the queue is shrinked, so + * it'll be processed only after one existing in-band command + * finishes. + */ + for (i =3D 1; i <=3D QMP_REQ_QUEUE_LEN_MAX; i++) { + id =3D g_strdup_printf("queue-blocks-%d", i); + send_cmd_that_blocks(qts, id); + g_free(id); + } + send_oob_cmd_that_fails(qts, "oob-1"); + unblock_blocked_cmd(); + recv_cmd_id(qts, "queue-blocks-1"); + recv_cmd_id(qts, "oob-1"); + for (i =3D 2; i <=3D QMP_REQ_QUEUE_LEN_MAX; i++) { + unblock_blocked_cmd(); + id =3D g_strdup_printf("queue-blocks-%d", i); + recv_cmd_id(qts, id); + g_free(id); + } + cleanup_blocking_cmd(); =20 qtest_quit(qts); --=20 2.17.1