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 <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Michal Privoznik committed 2026-01-29 13:38:57 +01:00
1 parent 30baa49454
commit eff3431dca
1 file changed
+7 -3
+7 -3
View 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: