mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
qemudomainsnapshotxml2xmltest: Allow regenerating into non-existing output file
Replacing the 'virTestLoadFile' + 'virTestDifferenceFull' by ' virTestCompareToFile' allows to use the VIR_TEST_REGENERATE_OUTPUT=1 option to also generate the output file if it doesn't exist. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
41460774ea
commit
bbda8bea04
@ -30,7 +30,6 @@ testCompareXMLToXMLFiles(const char *inxml,
|
|||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
g_autofree char *inXmlData = NULL;
|
g_autofree char *inXmlData = NULL;
|
||||||
g_autofree char *outXmlData = NULL;
|
|
||||||
g_autofree char *actual = NULL;
|
g_autofree char *actual = NULL;
|
||||||
unsigned int parseflags = 0;
|
unsigned int parseflags = 0;
|
||||||
unsigned int formatflags = VIR_DOMAIN_SNAPSHOT_FORMAT_SECURE;
|
unsigned int formatflags = VIR_DOMAIN_SNAPSHOT_FORMAT_SECURE;
|
||||||
@ -48,9 +47,6 @@ testCompareXMLToXMLFiles(const char *inxml,
|
|||||||
if (virTestLoadFile(inxml, &inXmlData) < 0)
|
if (virTestLoadFile(inxml, &inXmlData) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (virTestLoadFile(outxml, &outXmlData) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (!(def = virDomainSnapshotDefParseString(inXmlData,
|
if (!(def = virDomainSnapshotDefParseString(inXmlData,
|
||||||
driver.xmlopt, NULL, &cur,
|
driver.xmlopt, NULL, &cur,
|
||||||
parseflags)))
|
parseflags)))
|
||||||
@ -71,10 +67,8 @@ testCompareXMLToXMLFiles(const char *inxml,
|
|||||||
formatflags)))
|
formatflags)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (STRNEQ(outXmlData, actual)) {
|
if (virTestCompareToFile(actual, outxml) < 0)
|
||||||
virTestDifferenceFull(stderr, outXmlData, outxml, actual, inxml);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user