From nobody Thu Nov 6 12:14:10 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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1540927128479162.5920729056253; Tue, 30 Oct 2018 12:18:48 -0700 (PDT) Received: from localhost ([::1]:55087 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHZXB-0003yN-Gk for importer@patchew.org; Tue, 30 Oct 2018 15:18:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37685) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHZVL-00031H-39 for qemu-devel@nongnu.org; Tue, 30 Oct 2018 15:16:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHZVI-0005rs-GR for qemu-devel@nongnu.org; Tue, 30 Oct 2018 15:16:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57240) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gHZVI-0005k6-8Q for qemu-devel@nongnu.org; Tue, 30 Oct 2018 15:16:40 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3ECA9307C94A for ; Tue, 30 Oct 2018 19:16:26 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-117-34.ams2.redhat.com [10.36.117.34]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2775A5D75C; Tue, 30 Oct 2018 19:16:24 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id F3E321132BA7; Tue, 30 Oct 2018 20:16:20 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Tue, 30 Oct 2018 20:16:19 +0100 Message-Id: <20181030191620.32168-8-armbru@redhat.com> In-Reply-To: <20181030191620.32168-1-armbru@redhat.com> References: <20181030191620.32168-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Tue, 30 Oct 2018 19:16:26 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 7/8] 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: Peter Xu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Peter Xu 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 Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Peter Xu Message-Id: <20181009062718.1914-7-peterx@redhat.com> Signed-off-by: Markus Armbruster --- tests/qmp-test.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/qmp-test.c b/tests/qmp-test.c index cc9907b525..6989acbca4 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 @@ -218,6 +219,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 @@ -272,6 +275,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.2