[libvirt] [PATCH 3/3] virjsontest: switch AddAndRemove tests to work with files

Andrea Bolognani abologna at redhat.com
Wed Feb 13 13:39:34 UTC 2019


On Tue, 2019-02-12 at 16:57 +0100, Ján Tomko wrote:
[...]
> +++ b/tests/virjsontest.c
> @@ -114,12 +114,24 @@ static int
>  testJSONAddRemove(const void *data)
>  {
>      const struct testInfo *info = data;
> -    virJSONValuePtr json;
> +    virJSONValuePtr json = NULL;
>      virJSONValuePtr name = NULL;
> -    char *result = NULL;
> +    char *infile = NULL;
> +    char *indata = NULL;
> +    char *outfile = NULL;
> +    char *actual = NULL;

Feel free to convert this function and the rest of the file to
VIR_AUTOFREE() in a follow-up series O:-)

> @@ -159,20 +171,22 @@ testJSONAddRemove(const void *data)
>          VIR_TEST_VERBOSE("%s", "unexpected failure adding new key\n");
>          goto cleanup;
>      }
> -    if (!(result = virJSONValueToString(json, false))) {
> +    if (!(actual = virJSONValueToString(json, false))) {

The amount of data is much smaller in this case, so whether or not
it's pretty printed doesn't make a lot of difference. I'd still
pretty print everything for consistency and because it just looks
much better, but it's okay to leave it as is too.

Reviewed-by: Andrea Bolognani <abologna at redhat.com>

-- 
Andrea Bolognani / Red Hat / Virtualization




More information about the libvir-list mailing list