[libvirt] [PATCH 1/4] tests: schema: Add possibility to validate individual files

Andrea Bolognani abologna at redhat.com
Tue Mar 28 13:23:41 UTC 2017


On Tue, 2017-03-28 at 13:58 +0200, Peter Krempa wrote:
[...]
> @@ -196,6 +192,30 @@ mymain(void)
>          }                                                                      \
>      } while (0)
> 
> +#define DO_TEST_FILE(sch, xmlfile)                                             \
> +    do {                                                                       \
> +        data.schema = sch;                                                     \
> +        data.xml_path = xmlfile;                                               \
> +        if (virTestRun("test schema grammar file: " sch,                       \
> +                       testSchemaGrammar, &data) == 0) {                       \
> +            /* initialize the validator even if the schema test                \
> +             * was skipped because of VIR_TEST_RANGE */                        \
> +            if (!data.validator && testSchemaGrammar(&data) < 0) {             \
> +                ret = -1;                                                      \
> +                break;                                                         \
> +            }                                                                  \
> +            if (virTestRun("Checking " xmlfile " against " sch,                \
> +                           testSchemaFile, &data) < 0)                         \
> +                ret = -1;                                                      \
> +                                                                               \
> +            virXMLValidatorFree(data.validator);                               \
> +            data.validator = NULL;                                             \
> +        } else {                                                               \
> +            ret = -1;                                                          \
> +        }                                                                      \
> +    } while (0)
> +
> +

Only one empty line here, please.


Now that you've introduced DO_TEST_FILE(), I think it would
make sense to rename DO_TEST() to DO_TEST_DIRS() for clarity.

ACK whether you feel the same or not.

-- 
Andrea Bolognani / Red Hat / Virtualization




More information about the libvir-list mailing list