{
g_autofree char *xml = NULL;
g_autofree char *actual = NULL;
- int ret = -1;
xml = g_strdup_printf("%s/cputestdata/%s-%s.xml", abs_srcdir,
virArchToString(arch), name);
if (!(actual = virCPUDefFormat(cpu, NULL)))
- goto cleanup;
+ return -1;
if (virTestCompareToFile(actual, xml) < 0)
- goto cleanup;
-
- ret = 0;
+ return -1;
- cleanup:
- return ret;
+ return 0;
}
cpuTestCompare(const void *arg)
{
const struct data *data = arg;
- int ret = -1;
g_autoptr(virCPUDef) host = NULL;
g_autoptr(virCPUDef) cpu = NULL;
virCPUCompareResult result;
if (!(host = cpuTestLoadXML(data->arch, data->host)) ||
!(cpu = cpuTestLoadXML(data->arch, data->name)))
- goto cleanup;
+ return -1;
result = virCPUCompare(host->arch, host, cpu, false);
if (data->result == VIR_CPU_COMPARE_ERROR)
cpuTestCompResStr(result));
/* Pad to line up with test name ... in virTestRun */
VIR_TEST_VERBOSE("%74s", "... ");
- goto cleanup;
+ return -1;
}
- ret = 0;
-
- cleanup:
- return ret;
+ return 0;
}
cpuTestUpdate(const void *arg)
{
const struct data *data = arg;
- int ret = -1;
g_autoptr(virCPUDef) host = NULL;
g_autoptr(virCPUDef) migHost = NULL;
g_autoptr(virCPUDef) cpu = NULL;
if (!(host = cpuTestLoadXML(data->arch, data->host)) ||
!(cpu = cpuTestLoadXML(data->arch, data->name)))
- goto cleanup;
+ return -1;
if (!(migHost = virCPUCopyMigratable(data->arch, host)))
- goto cleanup;
+ return -1;
if (virCPUUpdate(host->arch, cpu, migHost) < 0)
- goto cleanup;
+ return -1;
result = g_strdup_printf("%s+%s", data->host, data->name);
- ret = cpuTestCompareXML(data->arch, cpu, result);
-
- cleanup:
- return ret;
+ return cpuTestCompareXML(data->arch, cpu, result);
}
cpuTestHasFeature(const void *arg)
{
const struct data *data = arg;
- int ret = -1;
g_autoptr(virCPUDef) host = NULL;
g_autoptr(virCPUData) hostData = NULL;
int result;
if (!(host = cpuTestLoadXML(data->arch, data->host)))
- goto cleanup;
+ return -1;
if (cpuEncode(host->arch, host, NULL, &hostData,
NULL, NULL, NULL, NULL) < 0)
- goto cleanup;
+ return -1;
result = virCPUCheckFeature(host->arch, host, data->name);
cpuTestBoolWithErrorStr(result));
/* Pad to line up with test name ... in virTestRun */
VIR_TEST_VERBOSE("%74s", "... ");
- goto cleanup;
+ return -1;
}
- ret = 0;
-
- cleanup:
- return ret;
+ return 0;
}
g_autoptr(virCPUData) hostData = NULL;
g_autofree char *hostFile = NULL;
g_autofree char *host = NULL;
- int ret = -1;
hostFile = g_strdup_printf("%s/cputestdata/%s-cpuid-%s.xml", abs_srcdir,
virArchToString(data->arch), data->host);
if (virTestLoadFile(hostFile, &host) < 0 ||
!(hostData = virCPUDataParse(host)))
- goto cleanup;
-
- ret = cpuTestCompareSignature(data, hostData);
+ return -1;
- cleanup:
- return ret;
+ return cpuTestCompareSignature(data, hostData);
}
g_autoptr(virQEMUCaps) qemuCaps = NULL;
g_autoptr(virCPUDef) cpu = NULL;
g_autofree char *result = NULL;
- int ret = -1;
result = g_strdup_printf("cpuid-%s-json", data->host);
if (!(qemuCaps = cpuTestMakeQEMUCaps(data)))
- goto cleanup;
+ return -1;
cpu = virCPUDefNew();
cpu->arch = data->arch;
cpu->fallback = VIR_CPU_FALLBACK_FORBID;
if (virQEMUCapsInitCPUModel(qemuCaps, VIR_DOMAIN_VIRT_KVM, cpu, false) != 0)
- goto cleanup;
-
- ret = cpuTestCompareXML(data->arch, cpu, result);
+ return -1;
- cleanup:
- return ret;
+ return cpuTestCompareXML(data->arch, cpu, result);
}
g_autoptr(virQEMUCaps) qemuCaps = NULL;
g_autoptr(virCPUData) hostData = NULL;
qemuMonitorCPUModelInfo *modelInfo;
- int ret = -1;
if (!(qemuCaps = cpuTestMakeQEMUCaps(data)))
- goto cleanup;
+ return -1;
modelInfo = virQEMUCapsGetCPUModelInfo(qemuCaps, VIR_DOMAIN_VIRT_KVM);
if (!(hostData = virQEMUCapsGetCPUModelX86Data(qemuCaps, modelInfo, false)))
- goto cleanup;
-
- ret = cpuTestCompareSignature(data, hostData);
+ return -1;
- cleanup:
- return ret;
+ return cpuTestCompareSignature(data, hostData);
}
#endif