[libvirt] [PATCH] tests: Make schema test fail on XML schema errors

Ján Tomko jtomko at redhat.com
Tue Aug 2 14:09:58 UTC 2016


On Tue, Aug 02, 2016 at 09:19:07AM +0200, Peter Krempa wrote:
>Failure to parse the schema file would not trigger a test suite failure.
>
>In addition to making the test fail it's necessary to split up the
>parsing of the schema file into a separate test.
>
>This is necessary as the XML validator uses libvirt errors to report
>problems parsing of the actual schema RNG needs to be split out into a
>separate function and called via virTestRun which has the
>infrastructure to report them.
>---
> tests/virschematest.c | 64 ++++++++++++++++++++++++++++++++++++---------------
> 1 file changed, 46 insertions(+), 18 deletions(-)
>
>diff --git a/tests/virschematest.c b/tests/virschematest.c
>index a1901e7..dbd9f3b 100644
>--- a/tests/virschematest.c
>+++ b/tests/virschematest.c
>@@ -114,24 +114,17 @@ testSchemaDir(const char *schema,
>
>
> static int
>-testSchemaDirs(const char *schema, ...)
>+testSchemaDirs(const char *schema, virXMLValidatorPtr validator, ...)
> {
>-    virXMLValidatorPtr validator = NULL;
>     va_list args;
>     int ret = 0;
>-    char *schema_path = NULL;
>     char *dir_path = NULL;
>     const char *dir;
>
>-    va_start(args, schema);
>-
>-    if (virAsprintf(&schema_path, "%s/docs/schemas/%s", abs_topsrcdir, schema) < 0)
>-        goto cleanup;
>-
>-    if (!(validator = virXMLValidatorInit(schema_path)))
>-        goto cleanup;
>+    va_start(args, validator);
>
>     while ((dir = va_arg(args, char *))) {

>+        printf("\nDERP: %s\n", dir);

ACK with this line removed.

Jan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160802/0d3a3001/attachment-0001.sig>


More information about the libvir-list mailing list