]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
networkxml2conftest: Allow regenerating more in one run
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 17 Dec 2025 12:24:06 +0000 (13:24 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 29 Jan 2026 12:38:57 +0000 (13:38 +0100)
Currently, there are two calls to virTestCompareToFile() inside
of testCompareXMLToConfFiles(). If the first one fails the
control jumps directly onto the fail label and skips the second
one. This means that When regenerating test case output
(VIR_TEST_REGENERATE_OUTPUT) the test binary has to be called
twice to regenerate all the files. Suboptimal. Try harder to call
both compare helpers.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tests/networkxml2conftest.c

index cb2cafa918431fc8b65e8558b3b29f5caac1b3da..c7534773a3949ef87a5fdb1277011188b9bdbb0e 100644 (file)
@@ -29,6 +29,7 @@ testCompareXMLToConfFiles(const char *inxml, const char *outconf,
     g_autofree char *pidfile = NULL;
     g_autoptr(dnsmasqContext) dctx = NULL;
     g_autoptr(virNetworkXMLOption) xmlopt = NULL;
+    bool compareFailed = false;
 
     if (!(xmlopt = networkDnsmasqCreateXMLConf()))
         goto fail;
@@ -73,20 +74,23 @@ testCompareXMLToConfFiles(const char *inxml, const char *outconf,
 #endif
 
     if (virTestCompareToFile(confactual, outconf) < 0)
-        goto fail;
+        compareFailed = true;
 
     if (hostsfileactual) {
         if (virTestCompareToFile(hostsfileactual, outhostsfile) < 0) {
-            goto fail;
+            compareFailed = true;
         }
     } else {
         if (virFileExists(outhostsfile)) {
             VIR_TEST_DEBUG("%s: hostsfile exists but the configuration did not specify any host",
                            outhostsfile);
-            goto fail;
+            compareFailed = true;
         }
     }
 
+    if (compareFailed)
+        goto fail;
+
     ret = 0;
 
  fail: