From: Peter Krempa Date: Thu, 25 Aug 2022 09:05:39 +0000 (+0200) Subject: qemudomainsnapshotxml2xmltest: Allow regenerating into non-existing output file X-Git-Tag: v8.8.0-rc1~125 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bbda8bea04c8d9b1b6814cd44b64938aaf0868ae;p=thirdparty%2Flibvirt.git 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 Reviewed-by: Ján Tomko --- diff --git a/tests/qemudomainsnapshotxml2xmltest.c b/tests/qemudomainsnapshotxml2xmltest.c index 2f66839ae8..6881d692ee 100644 --- a/tests/qemudomainsnapshotxml2xmltest.c +++ b/tests/qemudomainsnapshotxml2xmltest.c @@ -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; }