const struct testInfo *info = data;
char *xml_in = NULL;
char *xml_out = NULL;
+ char *xml_out_active = NULL;
+ char *xml_out_inactive = NULL;
int ret = -1;
if (virAsprintf(&xml_in, "%s/qemuxml2argvdata/qemuxml2argv-%s.xml",
abs_srcdir, info->name) < 0 ||
virAsprintf(&xml_out, "%s/qemuxml2xmloutdata/qemuxml2xmlout-%s.xml",
+ abs_srcdir, info->name) < 0 ||
+ virAsprintf(&xml_out_active,
+ "%s/qemuxml2xmloutdata/qemuxml2xmlout-%s-active.xml",
+ abs_srcdir, info->name) < 0 ||
+ virAsprintf(&xml_out_inactive,
+ "%s/qemuxml2xmloutdata/qemuxml2xmlout-%s-inactive.xml",
abs_srcdir, info->name) < 0)
goto cleanup;
- if ((info->when & WHEN_INACTIVE) &&
- testCompareXMLToXMLFiles(xml_in,
- info->different ? xml_out : xml_in,
- false) < 0)
- goto cleanup;
+ if ((info->when & WHEN_INACTIVE)) {
+ char *out;
+ if (!info->different)
+ out = xml_in;
+ else if (virFileExists(xml_out_inactive))
+ out = xml_out_inactive;
+ else
+ out = xml_out;
+
+ if (testCompareXMLToXMLFiles(xml_in, out, false) < 0)
+ goto cleanup;
+ }
- if ((info->when & WHEN_ACTIVE) &&
- testCompareXMLToXMLFiles(xml_in,
- info->different ? xml_out : xml_in,
- true) < 0)
- goto cleanup;
+ if ((info->when & WHEN_ACTIVE)) {
+ char *out;
+ if (!info->different)
+ out = xml_in;
+ else if (virFileExists(xml_out_active))
+ out = xml_out_active;
+ else
+ out = xml_out;
+
+ if (testCompareXMLToXMLFiles(xml_in, out, true) < 0)
+ goto cleanup;
+ }
ret = 0;
cleanup:
VIR_FREE(xml_in);
VIR_FREE(xml_out);
+ VIR_FREE(xml_out_active);
+ VIR_FREE(xml_out_inactive);
return ret;
}