[PATCH 3/7] qemudomainsnapshotxml2xmltest: Allow regenerating into non-existing output file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 tests/qemudomainsnapshotxml2xmltest.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

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;
 }
-- 
2.37.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux