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 <stefa...@redhat.com>
> ---
>  tests/libqtest.c | 66 
> ++++++++++++++++++++++++++++++++++++++++++++------------
>  tests/libqtest.h | 37 +++++++++++++++++++++++++++++++
>  2 files changed, 89 insertions(+), 14 deletions(-)

Reviewed-by: Eric Blake <ebl...@redhat.com>

> +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