[libvirt] [PATCHv2 1/5] testCompareDomXML2XMLFiles: add parseFlags parameter

Ján Tomko jtomko at redhat.com
Thu Feb 25 15:40:53 UTC 2016


Allow testing XML parsing with different flags.
---
 tests/bhyvexml2xmltest.c   | 2 +-
 tests/genericxml2xmltest.c | 2 +-
 tests/lxcxml2xmltest.c     | 2 +-
 tests/qemuxml2xmltest.c    | 4 ++--
 tests/testutils.c          | 5 ++++-
 tests/testutils.h          | 3 ++-
 6 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/tests/bhyvexml2xmltest.c b/tests/bhyvexml2xmltest.c
index 2d34a00..8f556ee 100644
--- a/tests/bhyvexml2xmltest.c
+++ b/tests/bhyvexml2xmltest.c
@@ -33,7 +33,7 @@ testCompareXMLToXMLHelper(const void *data)
     ret = testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, xml_in,
                                      info->different ? xml_out : xml_in,
                                      false,
-                                     NULL, NULL);
+                                     NULL, NULL, 0);
 
  cleanup:
     VIR_FREE(xml_in);
diff --git a/tests/genericxml2xmltest.c b/tests/genericxml2xmltest.c
index aa3a570..bf9b11d 100644
--- a/tests/genericxml2xmltest.c
+++ b/tests/genericxml2xmltest.c
@@ -40,7 +40,7 @@ testCompareXMLToXMLHelper(const void *data)
     ret = testCompareDomXML2XMLFiles(caps, xmlopt, xml_in,
                                      info->different ? xml_out : xml_in,
                                      !info->inactive_only,
-                                     NULL, NULL);
+                                     NULL, NULL, 0);
  cleanup:
     VIR_FREE(xml_in);
     VIR_FREE(xml_out);
diff --git a/tests/lxcxml2xmltest.c b/tests/lxcxml2xmltest.c
index aafebb4..8174a54 100644
--- a/tests/lxcxml2xmltest.c
+++ b/tests/lxcxml2xmltest.c
@@ -45,7 +45,7 @@ testCompareXMLToXMLHelper(const void *data)
     ret = testCompareDomXML2XMLFiles(caps, xmlopt, xml_in,
                                      info->different ? xml_out : xml_in,
                                      !info->inactive_only,
-                                     NULL, NULL);
+                                     NULL, NULL, 0);
  cleanup:
     VIR_FREE(xml_in);
     VIR_FREE(xml_out);
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index ef6e35a..80c80f6 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -54,7 +54,7 @@ testXML2XMLActive(const void *opaque)
 
     return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt,
                                       info->inName, info->outActiveName, true,
-                                      qemuXML2XMLPreFormatCallback, opaque);
+                                      qemuXML2XMLPreFormatCallback, opaque, 0);
 }
 
 
@@ -65,7 +65,7 @@ testXML2XMLInactive(const void *opaque)
 
     return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, info->inName,
                                       info->outInactiveName, false,
-                                      qemuXML2XMLPreFormatCallback, opaque);
+                                      qemuXML2XMLPreFormatCallback, opaque, 0);
 }
 
 
diff --git a/tests/testutils.c b/tests/testutils.c
index c1ca656..b1bd4e8 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -1054,13 +1054,16 @@ int
 testCompareDomXML2XMLFiles(virCapsPtr caps, virDomainXMLOptionPtr xmlopt,
                            const char *infile, const char *outfile, bool live,
                            testCompareDomXML2XMLPreFormatCallback cb,
-                           const void *opaque)
+                           const void *opaque, unsigned int parseFlags)
 {
     char *actual = NULL;
     int ret = -1;
     virDomainDefPtr def = NULL;
     unsigned int parse_flags = live ? 0 : VIR_DOMAIN_DEF_PARSE_INACTIVE;
     unsigned int format_flags = VIR_DOMAIN_DEF_FORMAT_SECURE;
+
+    parse_flags |= parseFlags;
+
     if (!live)
         format_flags |= VIR_DOMAIN_DEF_FORMAT_INACTIVE;
 
diff --git a/tests/testutils.h b/tests/testutils.h
index bb58148..752fa52 100644
--- a/tests/testutils.h
+++ b/tests/testutils.h
@@ -142,6 +142,7 @@ int testCompareDomXML2XMLFiles(virCapsPtr caps,
                                const char *outfile,
                                bool live,
                                testCompareDomXML2XMLPreFormatCallback cb,
-                               const void *opaque);
+                               const void *opaque,
+                               unsigned int parseFlags);
 
 #endif /* __VIT_TEST_UTILS_H__ */
-- 
2.4.10




More information about the libvir-list mailing list