From patchwork Wed Sep 5 06:23:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 966228 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=208.118.235.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 424tyv4HZPz9sCf for ; Wed, 5 Sep 2018 16:27:03 +1000 (AEST) Received: from localhost ([::1]:54013 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fxRHJ-0000UJ-AD for incoming@patchwork.ozlabs.org; Wed, 05 Sep 2018 02:27:01 -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_Lure?= =?utf-8?q?au?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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é 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" const char common_args[] = "-nodefaults -machine none"; @@ -248,6 +249,8 @@ static void test_qmp_oob(void) const QListEntry *entry; QList *capabilities; QString *qstr; + gchar *id; + int i; qts = qtest_init_without_qmp_handshake(common_args); @@ -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 = 1; i <= QMP_REQ_QUEUE_LEN_MAX; i++) { + id = 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 = 2; i <= QMP_REQ_QUEUE_LEN_MAX; i++) { + unblock_blocked_cmd(); + id = g_strdup_printf("queue-blocks-%d", i); + recv_cmd_id(qts, id); + g_free(id); + } + cleanup_blocking_cmd(); qtest_quit(qts);