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

Re: [libvirt] [PATCH 22/24] tests: qemumonitorjson: Old and empty test case for node name detection

On 07/26/2017 05:00 AM, Peter Krempa wrote:
> Prior to qemu 2.5 the node names would not be generated, thus would be
> missing from 'query-blockstats' and 'query-named-block-nodes'. Test that
> the code correctly detects nothing.
> Additionally make sure that a VM without disks does not cause problems.
> The test case change is necessary as our test file checker does not play
> well with empty files.

Can you use a file consisting of solely backslash-newline?  That is not
empty, but with \\\n folding becomes an empty string.  That might be a
bit simpler than:

> +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-empty.result
> @@ -0,0 +1 @@
> +nothing

> +++ b/tests/qemumonitorjsontest.c
> @@ -2763,6 +2763,9 @@ testBlockNodeNameDetect(const void *opaque)
>      virBufferTrim(&buf, "\n", -1);
> +    if (virBufferUse(&buf) == 0)
> +        virBufferAddLit(&buf, "nothing\n");

having to special case "nothing".

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

Attachment: signature.asc
Description: OpenPGP digital signature

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