static int
testCompareFiles(const char *vmx, const char *xml, bool should_fail_parse)
{
- int ret = -1;
g_autofree char *vmxData = NULL;
g_autofree char *formatted = NULL;
g_autoptr(virDomainDef) def = NULL;
def = virVMXParseConfig(&ctx, xmlopt, caps, vmxData);
if (should_fail_parse) {
if (!def)
- ret = 0;
- else
- VIR_TEST_DEBUG("passed instead of expected failure");
- goto cleanup;
+ return 0;
+
+ VIR_TEST_DEBUG("passed instead of expected failure");
+ return -1;
}
if (!def)
- goto cleanup;
+ return -1;
if (!virDomainDefCheckABIStability(def, def, xmlopt)) {
fprintf(stderr, "ABI stability check failed on %s", vmx);
- goto cleanup;
+ return -1;
}
if (!(formatted = virDomainDefFormat(def, xmlopt,
VIR_DOMAIN_DEF_FORMAT_SECURE)))
- goto cleanup;
+ return -1;
if (virTestCompareToFile(formatted, xml) < 0)
- goto cleanup;
-
- ret = 0;
-
- cleanup:
+ return -1;
- return ret;
+ return 0;
}
struct testInfo {
static int
testCompareFiles(const char *xml, const char *vmx, int virtualHW_version)
{
- int result = -1;
g_autofree char *formatted = NULL;
g_autoptr(virDomainDef) def = NULL;
VIR_DOMAIN_DEF_PARSE_INACTIVE);
if (def == NULL)
- goto failure;
+ return -1;
if (!virDomainDefCheckABIStability(def, def, xmlopt)) {
fprintf(stderr, "ABI stability check failed on %s", xml);
- goto failure;
+ return -1;
}
formatted = virVMXFormatConfig(&ctx, xmlopt, def, virtualHW_version);
if (formatted == NULL)
- goto failure;
+ return -1;
if (virTestCompareToFile(formatted, vmx) < 0)
- goto failure;
+ return -1;
- result = 0;
-
- failure:
-
- return result;
+ return 0;
}
struct testInfo {