@@ -78,6 +78,7 @@ static void test_qmp_protocol(void)
QList *capabilities;
const QListEntry *entry;
QString *qstr;
+ int i;
global_qtest = qtest_init_without_qmp_handshake(common_args);
@@ -135,6 +136,24 @@ 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.
+ */
+ for (i = 0; i < 16; i++) {
+ qmp_async("{ 'execute': 'query-version' }");
+ }
+ /* Verify the replies to make sure no command is dropped. */
+ for (i = 0; i < 16; i++) {
+ resp = qmp_receive();
+ /* 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_end();
}