aboutsummaryrefslogtreecommitdiff
path: root/tests/libqtest.h
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2018-08-23 18:39:33 +0200
committerMarkus Armbruster <armbru@redhat.com>2018-08-24 20:26:37 +0200
commitaed877c53b5b8760b3fdb3605a212188c60f2eb3 (patch)
tree852e96bdc65fe0ef631e6323806e024944fad4f1 /tests/libqtest.h
parentd93bb9d5c34c1b4ed97bf824e6459b5516db94f6 (diff)
qmp-test: Cover syntax and lexical errors
qmp-test neglects to cover QMP input that isn't valid JSON. libqtest doesn't let us send such input. Add qtest_qmp_send_raw() for this purpose, and put it to use in qmp-test. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20180823164025.12553-7-armbru@redhat.com> [Commit message typo fixed]
Diffstat (limited to 'tests/libqtest.h')
-rw-r--r--tests/libqtest.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/libqtest.h b/tests/libqtest.h
index 1159b73d15..0a401a5380 100644
--- a/tests/libqtest.h
+++ b/tests/libqtest.h
@@ -97,6 +97,17 @@ void qtest_qmp_send(QTestState *s, const char *fmt, ...)
GCC_FMT_ATTR(2, 3);
/**
+ * qtest_qmp_send_raw:
+ * @s: #QTestState instance to operate on.
+ * @fmt...: text to send, formatted like sprintf()
+ *
+ * Sends text to the QMP monitor verbatim. Need not be valid JSON;
+ * this is useful for negative tests.
+ */
+void qtest_qmp_send_raw(QTestState *s, const char *fmt, ...)
+ GCC_FMT_ATTR(2, 3);
+
+/**
* qtest_qmpv:
* @s: #QTestState instance to operate on.
* @fmt: QMP message to send to QEMU, formatted like