qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v3 4/7] libqtest: add qmp(fmt, ...) -> QDict* fu


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v3 4/7] libqtest: add qmp(fmt, ...) -> QDict* function
Date: Tue, 05 Nov 2013 04:56:13 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0

On 10/30/2013 07:54 AM, Stefan Hajnoczi wrote:
> Add a qtest qmp() function that returns the response object.  This
> allows test cases to verify the result or to check for error responses.
> It also allows waiting for QMP events.
> 
> Signed-off-by: Stefan Hajnoczi <address@hidden>
> ---
>  tests/libqtest.c | 66 
> ++++++++++++++++++++++++++++++++++++++++++++------------
>  tests/libqtest.h | 37 +++++++++++++++++++++++++++++++
>  2 files changed, 89 insertions(+), 14 deletions(-)

Reviewed-by: Eric Blake <address@hidden>

> +static void qmp_response(JSONMessageParser *parser, QList *tokens)
>  {
> -    bool has_reply = false;
> -    int nesting = 0;
> +    QMPResponseParser *qmp = container_of(parser, QMPResponseParser, parser);
> +    QObject *obj;
> +
> +    obj = json_parser_parse(tokens, NULL);
> +    if (!obj) {
> +        fprintf(stderr, "QMP JSON response parsing failed\n");
> +        exit(1);

I prefer EXIT_FAILURE, but you're not the first person to use 1 instead.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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