[libvirt] [libvirt-glib 21/23] Validate document in parsing test

Christophe Fergeau cfergeau at redhat.com
Fri Oct 7 09:41:06 UTC 2011


Add a call to gvir_config_object_validate in test-domain-parse.c
However at the moment this call is purely informative since none
of the tests is a valid domain XML description.
---
 libvirt-gconfig/tests/test-domain-parse.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/libvirt-gconfig/tests/test-domain-parse.c b/libvirt-gconfig/tests/test-domain-parse.c
index 57b1875..545e733 100644
--- a/libvirt-gconfig/tests/test-domain-parse.c
+++ b/libvirt-gconfig/tests/test-domain-parse.c
@@ -56,6 +56,12 @@ int main(int argc, char **argv)
         return 3;
     }
     g_assert(domain != NULL);
+    gvir_config_object_validate(GVIR_CONFIG_OBJECT(domain), &error);
+    if (error != NULL) {
+        g_print("%s format is invalid: %s\n", argv[1], error->message);
+        g_clear_error(&error);
+    }
+
     name = gvir_config_domain_get_name(domain);
     g_assert(name != NULL);
     g_assert(strcmp(name, "foo") == 0);
-- 
1.7.6.4




More information about the libvir-list mailing list