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

Eric Blake eblake at redhat.com
Wed Jul 26 22:08:00 UTC 2017


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170726/11c3fdb5/attachment-0001.sig>


More information about the libvir-list mailing list