[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 05/34] tests/test-qmp-cmds: Factor out qmp_dispatch() test

From: Eric Blake
Subject: Re: [PATCH v3 05/34] tests/test-qmp-cmds: Factor out qmp_dispatch() test helpers
Date: Mon, 16 Mar 2020 12:16:50 -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:
Checking the value of qmp_dispatch() is repetitive.  Factor out
helpers do_qmp_dispatch() and do_qmp_dispatch_error().  Without this,
the next commit would make things even more repetitive.

Signed-off-by: Markus Armbruster <address@hidden>
  tests/test-qmp-cmds.c | 72 +++++++++++++++++++++----------------------
  1 file changed, 35 insertions(+), 37 deletions(-)

+static void do_qmp_dispatch_error(QDict *req, bool allow_oob, ErrorClass cls)
+    QDict *resp;
+    resp = qmp_dispatch(&qmp_commands, QOBJECT(req), allow_oob);
+    g_assert(resp && qdict_haskey(resp, "error"));
+    qobject_unref(resp);

No checking of cls?  Or is that what you hint at as coming later?

At any rate, the refactoring is sane.
Reviewed-by: Eric Blake <address@hidden>

Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

reply via email to

[Prev in Thread] Current Thread [Next in Thread]