|
From: | Eric Blake |
Subject: | Re: [PATCH v3 06/34] tests/test-qmp-cmds: Check responses more thoroughly |
Date: | Mon, 16 Mar 2020 12:18:56 -0500 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 |
On 3/15/20 9:46 AM, Markus Armbruster wrote:
Signed-off-by: Markus Armbruster <address@hidden> --- tests/test-qmp-cmds.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-)
@@ -163,9 +164,17 @@ static QObject *do_qmp_dispatch(QDict *req, bool allow_oob) static void do_qmp_dispatch_error(QDict *req, bool allow_oob, ErrorClass cls) { QDict *resp; + QDict *error;resp = qmp_dispatch(&qmp_commands, QOBJECT(req), allow_oob);- g_assert(resp && qdict_haskey(resp, "error")); + g_assert(resp); + error = qdict_get_qdict(resp, "error"); + g_assert(error); + g_assert_cmpstr(qdict_get_try_str(error, "class"), + ==, QapiErrorClass_str(cls));
Yep, this answers my question from 5/34.
+ g_assert(qdict_get_try_str(error, "desc")); + g_assert(qdict_size(error) == 2); + g_assert(qdict_size(resp) == 1);
Reviewed-by: Eric Blake <address@hidden> -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
[Prev in Thread] | Current Thread | [Next in Thread] |