aboutsummaryrefslogtreecommitdiff
path: root/tests/test-qmp-cmds.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-07-05 11:25:14 +0100
committerPeter Maydell <peter.maydell@linaro.org>2018-07-05 11:25:14 +0100
commit4fd1cbaf146d4ab35f465bba0fe23115c33cd5a7 (patch)
treed93d0fa4d40d7b5a76d22b9469da56012d4a18e3 /tests/test-qmp-cmds.c
parent5dafaf4fbceeb4c5d204039045b50b2f37443ff4 (diff)
parent153d73f320f422ecb5807ac3a93547b9f819599b (diff)
Merge remote-tracking branch 'remotes/armbru/tags/pull-monitor-2018-07-03-v2' into staging
Monitor patches for 2018-07-03 # gpg: Signature made Tue 03 Jul 2018 22:20:13 BST # gpg: using RSA key 3870B400EB918653 # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * remotes/armbru/tags/pull-monitor-2018-07-03-v2: (32 commits) qapi: Polish command flags documentation in qapi-code-gen.txt monitor: Improve some comments qmp: Clean up capability negotiation after commit 02130314d8c qobject: Let qobject_from_jsonf() fail instead of abort qmp: Switch timestamp_put() to qdict_from_jsonf_nofail() qmp: Add some comments around null responses qmp: Simplify monitor_qmp_respond() qmp: Replace get_qmp_greeting() by qmp_greeting() qmp: Replace monitor_json_emitter{,raw}() by qmp_{queue,send}_response() qmp: Use QDict * instead of QObject * for response objects qmp: De-duplicate error response building qobject: New qdict_from_jsonf_nofail() monitor: Peel off @mon_global wrapper monitor: Rename use_io_thr to use_io_thread qmp: Don't let JSON errors jump the queue qmp: Don't let malformed in-band commands jump the queue tests/qmp-test: Demonstrate QMP errors jumping the queue qmp: Simplify code around monitor_qmp_dispatch_one() qmp: Always free QMPRequest with qmp_request_free() qmp: Revert change to handle_qmp_command tracepoint ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests/test-qmp-cmds.c')
-rw-r--r--tests/test-qmp-cmds.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/tests/test-qmp-cmds.c b/tests/test-qmp-cmds.c
index ce277c9c3b..ba41a6161e 100644
--- a/tests/test-qmp-cmds.c
+++ b/tests/test-qmp-cmds.c
@@ -110,13 +110,13 @@ __org_qemu_x_Union1 *qmp___org_qemu_x_command(__org_qemu_x_EnumList *a,
static void test_dispatch_cmd(void)
{
QDict *req = qdict_new();
- QObject *resp;
+ QDict *resp;
qdict_put_str(req, "execute", "user_def_cmd");
- resp = qmp_dispatch(&qmp_commands, QOBJECT(req));
+ resp = qmp_dispatch(&qmp_commands, QOBJECT(req), false);
assert(resp != NULL);
- assert(!qdict_haskey(qobject_to(QDict, resp), "error"));
+ assert(!qdict_haskey(resp, "error"));
qobject_unref(resp);
qobject_unref(req);
@@ -127,13 +127,13 @@ static void test_dispatch_cmd_failure(void)
{
QDict *req = qdict_new();
QDict *args = qdict_new();
- QObject *resp;
+ QDict *resp;
qdict_put_str(req, "execute", "user_def_cmd2");
- resp = qmp_dispatch(&qmp_commands, QOBJECT(req));
+ resp = qmp_dispatch(&qmp_commands, QOBJECT(req), false);
assert(resp != NULL);
- assert(qdict_haskey(qobject_to(QDict, resp), "error"));
+ assert(qdict_haskey(resp, "error"));
qobject_unref(resp);
qobject_unref(req);
@@ -145,9 +145,9 @@ static void test_dispatch_cmd_failure(void)
qdict_put_str(req, "execute", "user_def_cmd");
- resp = qmp_dispatch(&qmp_commands, QOBJECT(req));
+ resp = qmp_dispatch(&qmp_commands, QOBJECT(req), false);
assert(resp != NULL);
- assert(qdict_haskey(qobject_to(QDict, resp), "error"));
+ assert(qdict_haskey(resp, "error"));
qobject_unref(resp);
qobject_unref(req);
@@ -155,18 +155,15 @@ static void test_dispatch_cmd_failure(void)
static QObject *test_qmp_dispatch(QDict *req)
{
- QObject *resp_obj;
QDict *resp;
QObject *ret;
- resp_obj = qmp_dispatch(&qmp_commands, QOBJECT(req));
- assert(resp_obj);
- resp = qobject_to(QDict, resp_obj);
+ resp = qmp_dispatch(&qmp_commands, QOBJECT(req), false);
assert(resp && !qdict_haskey(resp, "error"));
ret = qdict_get(resp, "return");
assert(ret);
qobject_ref(ret);
- qobject_unref(resp_obj);
+ qobject_unref(resp);
return ret;
}