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:
Peter Krempa 2022-08-25 11:05:39 +02:00
parent 41460774ea
commit bbda8bea04

View File

@ -30,7 +30,6 @@ testCompareXMLToXMLFiles(const char *inxml,
unsigned int flags)
{
g_autofree char *inXmlData = NULL;
g_autofree char *outXmlData = NULL;
g_autofree char *actual = NULL;
unsigned int parseflags = 0;
unsigned int formatflags = VIR_DOMAIN_SNAPSHOT_FORMAT_SECURE;
@ -48,9 +47,6 @@ testCompareXMLToXMLFiles(const char *inxml,
if (virTestLoadFile(inxml, &inXmlData) < 0)
return -1;
if (virTestLoadFile(outxml, &outXmlData) < 0)
return -1;
if (!(def = virDomainSnapshotDefParseString(inXmlData,
driver.xmlopt, NULL, &cur,
parseflags)))
@ -71,10 +67,8 @@ testCompareXMLToXMLFiles(const char *inxml,
formatflags)))
return -1;
if (STRNEQ(outXmlData, actual)) {
virTestDifferenceFull(stderr, outXmlData, outxml, actual, inxml);
if (virTestCompareToFile(actual, outxml) < 0)
return -1;
}
return 0;
}