static int
virTestRewrapFile(const char *filename)
{
- int ret = -1;
g_autofree char *script = NULL;
g_autoptr(virCommand) cmd = NULL;
cmd = virCommandNewArgList(PYTHON, script, "--in-place", filename, NULL);
if (virCommandRun(cmd, NULL) < 0)
- goto cleanup;
+ return -1;
- ret = 0;
- cleanup:
- return ret;
+ return 0;
}
/**
virTestCompareToFile(const char *actual,
const char *filename)
{
- int ret = -1;
g_autofree char *filecontent = NULL;
g_autofree char *fixedcontent = NULL;
const char *cmpcontent = actual;
cmpcontent = "";
if (virTestLoadFile(filename, &filecontent) < 0 && !virTestGetRegenerate())
- goto failure;
+ return -1;
if (filecontent) {
size_t filecontentLen = strlen(filecontent);
virTestDifferenceFull(stderr,
filecontent, filename,
cmpcontent, NULL);
- goto failure;
+ return -1;
}
- ret = 0;
- failure:
- return ret;
+ return 0;
}
int
static int
virTestSetEnvPath(void)
{
- int ret = -1;
const char *path = getenv("PATH");
g_autofree char *new_path = NULL;
if (new_path &&
g_setenv("PATH", new_path, TRUE) == FALSE)
- goto cleanup;
+ return -1;
- ret = 0;
- cleanup:
- return ret;
+ return 0;
}
int virTestMain(int argc,
if ((guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_I686,
"/usr/bin/acme-virt", NULL,
0, NULL)) == NULL)
- goto error;
+ return NULL;
if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_TEST, NULL, NULL, 0, NULL))
- goto error;
+ return NULL;
if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU,
NULL, NULL, 0, NULL))
- goto error;
+ return NULL;
if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_KVM,
NULL, NULL, 0, NULL))
- goto error;
+ return NULL;
if ((guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_X86_64,
"/usr/bin/acme-virt", NULL,
0, NULL)) == NULL)
- goto error;
+ return NULL;
if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_TEST, NULL, NULL, 0, NULL))
- goto error;
+ return NULL;
if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU,
NULL, NULL, 0, NULL))
- goto error;
+ return NULL;
if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_KVM,
NULL, NULL, 0, NULL))
- goto error;
+ return NULL;
if (virTestGetDebug() > 1) {
caps_str = virCapabilitiesFormatXML(caps);
if (!caps_str)
- goto error;
+ return NULL;
VIR_TEST_DEBUG("Generic driver capabilities:\n%s", caps_str);
}
return g_steal_pointer(&caps);
-
- error:
- return NULL;
}