From: Michal Privoznik Date: Wed, 17 Dec 2025 12:24:06 +0000 (+0100) Subject: networkxml2conftest: Allow regenerating more in one run X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eff3431dca51bdcf56829eca2a35d0a1dd395f31;p=thirdparty%2Flibvirt.git networkxml2conftest: Allow regenerating more in one run 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 Reviewed-by: Ján Tomko --- diff --git a/tests/networkxml2conftest.c b/tests/networkxml2conftest.c index cb2cafa918..c7534773a3 100644 --- a/tests/networkxml2conftest.c +++ b/tests/networkxml2conftest.c @@ -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: