@@ -32,7 +32,7 @@ testCompareXMLToXMLHelper(const void *data)
ret = testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, xml_in,
info->different ? xml_out : xml_in,
- false,
+ false, 0,
NULL, NULL, 0);
cleanup:
@@ -39,7 +39,7 @@ testCompareXMLToXMLHelper(const void *data)
ret = testCompareDomXML2XMLFiles(caps, xmlopt, xml_in,
info->different ? xml_out : xml_in,
- !info->inactive_only,
+ !info->inactive_only, 0,
NULL, NULL, 0);
cleanup:
VIR_FREE(xml_in);
@@ -45,7 +45,7 @@ testCompareXMLToXMLHelper(const void *data)
ret = testCompareDomXML2XMLFiles(caps, xmlopt, xml_in,
info->different ? xml_out : xml_in,
- !info->inactive_only,
+ !info->inactive_only, 0,
NULL, NULL, info->parse_flags);
cleanup:
VIR_FREE(xml_in);
@@ -52,7 +52,8 @@ testXML2XMLActive(const void *opaque)
const struct testInfo *info = opaque;
return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt,
- info->inName, info->outActiveName, true,
+ info->inName, info->outActiveName,
+ true, 0,
qemuXML2XMLPreFormatCallback, opaque, 0);
}
@@ -63,7 +64,7 @@ testXML2XMLInactive(const void *opaque)
const struct testInfo *info = opaque;
return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, info->inName,
- info->outInactiveName, false,
+ info->outInactiveName, false, 0,
qemuXML2XMLPreFormatCallback, opaque, 0);
}
@@ -1052,7 +1052,8 @@ virDomainXMLOptionPtr virTestGenericDomainXMLConfInit(void)
int
testCompareDomXML2XMLFiles(virCapsPtr caps, virDomainXMLOptionPtr xmlopt,
- const char *infile, const char *outfile, bool live,
+ const char *infile, const char *outfile,
+ bool live, testCompareDomXML2XMLFlags flags,
testCompareDomXML2XMLPreFormatCallback cb,
const void *opaque, unsigned int parseFlags)
{
@@ -1067,8 +1068,12 @@ testCompareDomXML2XMLFiles(virCapsPtr caps, virDomainXMLOptionPtr xmlopt,
if (!live)
format_flags |= VIR_DOMAIN_DEF_FORMAT_INACTIVE;
- if (!(def = virDomainDefParseFile(infile, caps, xmlopt, parse_flags)))
+ if (!(def = virDomainDefParseFile(infile, caps, xmlopt, parse_flags))) {
+ if (!virtTestOOMActive() &&
+ (flags & TEST_COMPARE_DOM_XML2XML_FLAG_EXPECT_PARSE_ERROR))
+ goto ok;
goto fail;
+ }
if (!virDomainDefCheckABIStability(def, def)) {
VIR_TEST_DEBUG("ABI stability check failed on %s", infile);
@@ -1084,6 +1089,7 @@ testCompareDomXML2XMLFiles(virCapsPtr caps, virDomainXMLOptionPtr xmlopt,
if (virtTestCompareToFile(actual, outfile) < 0)
goto fail;
+ ok:
ret = 0;
fail:
VIR_FREE(actual);
@@ -134,6 +134,9 @@ int virtTestMain(int argc,
virCapsPtr virTestGenericCapsInit(void);
virDomainXMLOptionPtr virTestGenericDomainXMLConfInit(void);
+typedef enum {
+ TEST_COMPARE_DOM_XML2XML_FLAG_EXPECT_PARSE_ERROR = 1 << 0,
+} testCompareDomXML2XMLFlags;
typedef int (*testCompareDomXML2XMLPreFormatCallback)(virDomainDefPtr def,
const void *opaque);
int testCompareDomXML2XMLFiles(virCapsPtr caps,
@@ -141,6 +144,7 @@ int testCompareDomXML2XMLFiles(virCapsPtr caps,
const char *inxml,
const char *outfile,
bool live,
+ testCompareDomXML2XMLFlags flags,
testCompareDomXML2XMLPreFormatCallback cb,
const void *opaque,
unsigned int parseFlags);