[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 33/36] tests: qmp-test: verify command batching
From: |
Eric Blake |
Subject: |
[Qemu-devel] [PULL 33/36] tests: qmp-test: verify command batching |
Date: |
Mon, 12 Mar 2018 13:36:24 -0500 |
From: Peter Xu <address@hidden>
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 <address@hidden>
Signed-off-by: Peter Xu <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Eric Blake <address@hidden>
---
tests/qmp-test.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/tests/qmp-test.c b/tests/qmp-test.c
index a8384bdda3b..fd4033a13fd 100644
--- a/tests/qmp-test.c
+++ b/tests/qmp-test.c
@@ -82,6 +82,7 @@ static void test_qmp_protocol(void)
QTestState *qts;
const QListEntry *entry;
QString *qstr;
+ int i;
qts = qtest_init_without_qmp_handshake(common_args);
@@ -139,6 +140,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++) {
+ qtest_async_qmp(qts, "{ 'execute': 'query-version' }");
+ }
+ /* Verify the replies to make sure no command is dropped. */
+ for (i = 0; i < 16; i++) {
+ resp = qtest_qmp_receive(qts);
+ /* 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_quit(qts);
}
--
2.14.3
- [Qemu-devel] [PULL 15/36] qobject: let object_property_get_str() use new API, (continued)
- [Qemu-devel] [PULL 15/36] qobject: let object_property_get_str() use new API, Eric Blake, 2018/03/12
- [Qemu-devel] [PULL 23/36] monitor: let suspend_cnt be thread safe, Eric Blake, 2018/03/12
- [Qemu-devel] [PULL 27/36] monitor: send event when command queue full, Eric Blake, 2018/03/12
- [Qemu-devel] [PULL 25/36] monitor: separate QMP parser and dispatcher, Eric Blake, 2018/03/12
- [Qemu-devel] [PULL 31/36] monitor: enable IO thread for (qmp & !mux) typed, Eric Blake, 2018/03/12
- [Qemu-devel] [PULL 33/36] tests: qmp-test: verify command batching,
Eric Blake <=
- [Qemu-devel] [PULL 35/36] block/accounting: introduce latency histogram, Eric Blake, 2018/03/12
- [Qemu-devel] [PULL 36/36] qapi: add block latency histogram interface, Eric Blake, 2018/03/12
- [Qemu-devel] [PULL 07/36] qapi: Replace qobject_to_X(o) by qobject_to(X, o), Eric Blake, 2018/03/12
- Re: [Qemu-devel] [PULL 00/36] QAPI patches for 2018-03-12, 2.12 softfreeze, Peter Maydell, 2018/03/13