tests: vir: remove pointless labels

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
This commit is contained in:
Ján Tomko 2021-09-04 22:41:36 +02:00
parent cfef887893
commit 2ef57217f8
15 changed files with 108 additions and 216 deletions

View File

@ -153,10 +153,8 @@ test_virCapsDomainDataLookupQEMU(const void *data G_GNUC_UNUSED)
int ret = 0;
g_autoptr(virCaps) caps = NULL;
if (!(caps = testQemuCapsInit())) {
ret = -1;
goto out;
}
if (!(caps = testQemuCapsInit()))
return -1;
/* Checking each parameter individually */
CAPSCOMP(-1, VIR_ARCH_NONE, VIR_DOMAIN_VIRT_NONE, NULL, NULL,
@ -195,7 +193,6 @@ test_virCapsDomainDataLookupQEMU(const void *data G_GNUC_UNUSED)
"/usr/bin/qemu-system-aarch64", "pc");
CAPS_EXPECT_ERR(-1, VIR_ARCH_NONE, VIR_DOMAIN_VIRT_VMWARE, NULL, "pc");
out:
return ret;
}
#endif /* WITH_QEMU */
@ -207,10 +204,8 @@ test_virCapsDomainDataLookupLXC(const void *data G_GNUC_UNUSED)
int ret = 0;
g_autoptr(virCaps) caps = NULL;
if (!(caps = testLXCCapsInit())) {
ret = -1;
goto out;
}
if (!(caps = testLXCCapsInit()))
return -1;
CAPSCOMP(-1, VIR_ARCH_NONE, VIR_DOMAIN_VIRT_NONE, NULL, NULL,
VIR_DOMAIN_OSTYPE_EXE, VIR_ARCH_X86_64,
@ -219,7 +214,6 @@ test_virCapsDomainDataLookupLXC(const void *data G_GNUC_UNUSED)
VIR_DOMAIN_OSTYPE_EXE, VIR_ARCH_X86_64,
VIR_DOMAIN_VIRT_LXC, "/usr/libexec/libvirt_lxc", NULL);
out:
return ret;
}
#endif /* WITH_LXC */

View File

@ -67,7 +67,6 @@ static int testConfMemoryNoNewline(const void *opaque G_GNUC_UNUSED)
"uint = 12345";
g_autoptr(virConf) conf = virConfReadString(srcdata, 0);
int ret = -1;
virConfValue *val;
unsigned long long llvalue;
g_autofree char *str = NULL;
@ -77,49 +76,47 @@ static int testConfMemoryNoNewline(const void *opaque G_GNUC_UNUSED)
return -1;
if (!(val = virConfGetValue(conf, "ullong")))
goto cleanup;
return -1;
if (val->type != VIR_CONF_STRING)
goto cleanup;
return -1;
if (virStrToLong_ull(val->str, NULL, 10, &llvalue) < 0)
goto cleanup;
return -1;
if (llvalue != 123456789) {
fprintf(stderr, "Expected '123' got '%llu'\n", llvalue);
goto cleanup;
return -1;
}
if (virConfGetValueType(conf, "string") !=
VIR_CONF_STRING) {
fprintf(stderr, "expected a string for 'string'\n");
goto cleanup;
return -1;
}
if (virConfGetValueString(conf, "string", &str) < 0)
goto cleanup;
return -1;
if (STRNEQ_NULLABLE(str, "foo")) {
fprintf(stderr, "Expected 'foo' got '%s'\n", str);
goto cleanup;
return -1;
}
if (virConfGetValueType(conf, "uint") != VIR_CONF_ULLONG) {
fprintf(stderr, "expected an unsigned long for 'uint'\n");
goto cleanup;
return -1;
}
if (virConfGetValueInt(conf, "uint", &uintvalue) < 0)
goto cleanup;
return -1;
if (uintvalue != 12345) {
fprintf(stderr, "Expected 12345 got %ud\n", uintvalue);
goto cleanup;
return -1;
}
ret = 0;
cleanup:
return ret;
return 0;
}
@ -338,7 +335,6 @@ static int testConfParseString(const void *opaque G_GNUC_UNUSED)
"int = 6963472309248\n" \
"string = \"foo\"\n";
int ret = -1;
g_autoptr(virConf) conf = virConfReadString(srcdata, 0);
g_autofree char *str = NULL;
@ -348,25 +344,23 @@ static int testConfParseString(const void *opaque G_GNUC_UNUSED)
if (virConfGetValueType(conf, "string") !=
VIR_CONF_STRING) {
fprintf(stderr, "expected a string for 'string'\n");
goto cleanup;
return -1;
}
if (virConfGetValueString(conf, "string", &str) < 0)
goto cleanup;
return -1;
if (STRNEQ_NULLABLE(str, "foo")) {
fprintf(stderr, "Expected 'foo' got '%s'\n", str);
goto cleanup;
return -1;
}
if (virConfGetValueString(conf, "int", &str) != -1) {
fprintf(stderr, "Expected error for 'int'\n");
goto cleanup;
return -1;
}
ret = 0;
cleanup:
return ret;
return 0;
}

View File

@ -38,22 +38,19 @@ testCryptoHash(const void *opaque)
{
const struct testCryptoHashData *data = opaque;
g_autofree char *actual = NULL;
int ret = -1;
if (virCryptoHashString(data->hash, data->input, &actual) < 0) {
fprintf(stderr, "Failed to generate crypto hash\n");
goto cleanup;
return -1;
}
if (STRNEQ_NULLABLE(data->output, actual)) {
fprintf(stderr, "Expected hash '%s' but got '%s'\n",
data->output, NULLSTR(actual));
goto cleanup;
return -1;
}
ret = 0;
cleanup:
return ret;
return 0;
}
@ -75,7 +72,6 @@ testCryptoEncrypt(const void *opaque)
size_t ivlen = 16;
g_autofree uint8_t *ciphertext = NULL;
size_t ciphertextlen = 0;
int ret = -1;
if (!virCryptoHaveCipher(data->algorithm)) {
fprintf(stderr, "cipher algorithm=%d unavailable\n", data->algorithm);
@ -88,29 +84,26 @@ testCryptoEncrypt(const void *opaque)
if (virRandomBytes(enckey, enckeylen) < 0 ||
virRandomBytes(iv, ivlen) < 0) {
fprintf(stderr, "Failed to generate random bytes\n");
goto cleanup;
return -1;
}
if (virCryptoEncryptData(data->algorithm, enckey, enckeylen, iv, ivlen,
data->input, data->inputlen,
&ciphertext, &ciphertextlen) < 0)
goto cleanup;
return -1;
if (data->ciphertextlen != ciphertextlen) {
fprintf(stderr, "Expected ciphertextlen(%zu) doesn't match (%zu)\n",
data->ciphertextlen, ciphertextlen);
goto cleanup;
return -1;
}
if (memcmp(data->ciphertext, ciphertext, ciphertextlen)) {
fprintf(stderr, "Expected ciphertext doesn't match\n");
goto cleanup;
return -1;
}
ret = 0;
cleanup:
return ret;
return 0;
}

View File

@ -103,7 +103,6 @@ static int
testFileSanitizePath(const void *opaque)
{
const struct testFileSanitizePathData *data = opaque;
int ret = -1;
g_autofree char *actual = NULL;
if (!(actual = virFileSanitizePath(data->path)))
@ -111,13 +110,10 @@ testFileSanitizePath(const void *opaque)
if (STRNEQ(actual, data->expect)) {
fprintf(stderr, "\nexpect: '%s'\nactual: '%s'\n", data->expect, actual);
goto cleanup;
return -1;
}
ret = 0;
cleanup:
return ret;
return 0;
}
@ -195,41 +191,38 @@ holesSupported(void)
off_t offsets[] = {EXTENT, EXTENT, EXTENT, -1};
off_t tmp;
VIR_AUTOCLOSE fd = -1;
bool ret = false;
if ((fd = makeSparseFile(offsets, true)) < 0)
goto cleanup;
return false;
/* The way this works is: there are 4K of data followed by 4K hole followed
* by 4K hole again. Check if the filesystem we are running the test suite
* on supports holes. */
if ((tmp = lseek(fd, 0, SEEK_DATA)) == (off_t) -1)
goto cleanup;
return false;
if (tmp != 0)
goto cleanup;
return false;
if ((tmp = lseek(fd, tmp, SEEK_HOLE)) == (off_t) -1)
goto cleanup;
return false;
if (tmp != EXTENT * 1024)
goto cleanup;
return false;
if ((tmp = lseek(fd, tmp, SEEK_DATA)) == (off_t) -1)
goto cleanup;
return false;
if (tmp != 2 * EXTENT * 1024)
goto cleanup;
return false;
if ((tmp = lseek(fd, tmp, SEEK_HOLE)) == (off_t) -1)
goto cleanup;
return false;
if (tmp != 3 * EXTENT * 1024)
goto cleanup;
return false;
ret = true;
cleanup:
return ret;
return true;
}
#else /* !WITH_DECL_SEEK_HOLE || !defined(__linux__)*/
@ -261,11 +254,10 @@ testFileInData(const void *opaque)
{
const struct testFileInData *data = opaque;
VIR_AUTOCLOSE fd = -1;
int ret = -1;
size_t i;
if ((fd = makeSparseFile(data->offsets, data->startData)) < 0)
goto cleanup;
return -1;
for (i = 0; data->offsets[i] != (off_t) -1; i++) {
bool shouldInData = data->startData;
@ -277,32 +269,29 @@ testFileInData(const void *opaque)
shouldInData = !shouldInData;
if (virFileInData(fd, &realInData, &realLen) < 0)
goto cleanup;
return -1;
if (realInData != shouldInData) {
fprintf(stderr, "Unexpected data/hole. Expected %s got %s\n",
shouldInData ? "data" : "hole",
realInData ? "data" : "hole");
goto cleanup;
return -1;
}
shouldLen = data->offsets[i] * 1024;
if (realLen != shouldLen) {
fprintf(stderr, "Unexpected section length. Expected %lld got %lld\n",
shouldLen, realLen);
goto cleanup;
return -1;
}
if (lseek(fd, shouldLen, SEEK_CUR) < 0) {
fprintf(stderr, "Unable to seek\n");
goto cleanup;
return -1;
}
}
ret = 0;
cleanup:
return ret;
return 0;
}

View File

@ -30,7 +30,6 @@ linuxTestCompareFiles(const char *cpuinfofile,
virArch arch,
const char *outputfile)
{
int ret = -1;
g_autofree char *actualData = NULL;
virNodeInfo nodeinfo;
g_autoptr(FILE) cpuinfo = NULL;
@ -39,7 +38,7 @@ linuxTestCompareFiles(const char *cpuinfofile,
if (!cpuinfo) {
fprintf(stderr, "unable to open: %s : %s\n",
cpuinfofile, g_strerror(errno));
goto fail;
return -1;
}
memset(&nodeinfo, 0, sizeof(nodeinfo));
@ -51,7 +50,7 @@ linuxTestCompareFiles(const char *cpuinfofile,
if (virGetLastErrorCode())
VIR_TEST_DEBUG("\n%s", virGetLastErrorMessage());
}
goto fail;
return -1;
}
actualData = g_strdup_printf("CPUs: %u/%u, MHz: %u, Nodes: %u, Sockets: %u, "
@ -61,12 +60,9 @@ linuxTestCompareFiles(const char *cpuinfofile,
nodeinfo.cores, nodeinfo.threads);
if (virTestCompareToFile(actualData, outputfile) < 0)
goto fail;
return -1;
ret = 0;
fail:
return ret;
return 0;
}

View File

@ -211,7 +211,6 @@ testISCSIGetSession(const void *data)
const struct testSessionInfo *info = data;
struct testIscsiadmCbData cbData = { 0 };
g_autofree char *actual_session = NULL;
int ret = -1;
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
cbData.output_version = info->output_version;
@ -225,13 +224,10 @@ testISCSIGetSession(const void *data)
"Expected session: '%s' got: '%s'",
NULLSTR(info->expected_session),
NULLSTR(actual_session));
goto cleanup;
return -1;
}
ret = 0;
cleanup:
return ret;
return 0;
}
struct testScanTargetsInfo {
@ -295,17 +291,14 @@ testISCSIConnectionLogin(const void *data)
{
const struct testConnectionInfoLogin *info = data;
struct testIscsiadmCbData cbData = { 0 };
int ret = -1;
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
virCommandSetDryRun(dryRunToken, NULL, false, false, testIscsiadmCb, &cbData);
if (virISCSIConnectionLogin(info->portal, info->initiatoriqn, info->target) < 0)
goto cleanup;
return -1;
ret = 0;
cleanup:
return ret;
return 0;
}

View File

@ -34,30 +34,25 @@
static int
checkOutput(virBuffer *buf, const char *exp_cmd)
{
int ret = -1;
g_autofree char *actual_cmd = NULL;
if (!(actual_cmd = virBufferContentAndReset(buf))) {
fprintf(stderr, "cannot compare buffer to exp: %s", exp_cmd);
goto cleanup;
return -1;
}
if (STRNEQ(exp_cmd, actual_cmd)) {
virTestDifference(stderr, exp_cmd, actual_cmd);
goto cleanup;
return -1;
}
ret = 0;
cleanup:
return ret;
return 0;
}
static int
testKModLoad(const void *args G_GNUC_UNUSED)
{
int ret = -1;
g_autofree char *errbuf = NULL;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
@ -67,23 +62,19 @@ testKModLoad(const void *args G_GNUC_UNUSED)
errbuf = virKModLoad(MODNAME);
if (errbuf) {
fprintf(stderr, "Failed to load, error: %s\n", errbuf);
goto cleanup;
return -1;
}
if (checkOutput(&buf, MODPROBE " -b " MODNAME "\n") < 0)
goto cleanup;
return -1;
ret = 0;
cleanup:
return ret;
return 0;
}
static int
testKModUnload(const void *args G_GNUC_UNUSED)
{
int ret = -1;
g_autofree char *errbuf = NULL;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
@ -93,16 +84,13 @@ testKModUnload(const void *args G_GNUC_UNUSED)
errbuf = virKModUnload(MODNAME);
if (errbuf) {
fprintf(stderr, "Failed to unload, error: %s\n", errbuf);
goto cleanup;
return -1;
}
if (checkOutput(&buf, RMMOD " " MODNAME "\n") < 0)
goto cleanup;
return -1;
ret = 0;
cleanup:
return ret;
return 0;
}

View File

@ -40,12 +40,11 @@ testMACLookup(const void *opaque)
GSList *next;
size_t i, j;
g_autofree char *file = NULL;
int ret = -1;
file = g_strdup_printf("%s/virmacmaptestdata/%s.json", abs_srcdir, data->file);
if (!(mgr = virMacMapNew(file)))
goto cleanup;
return -1;
macs = virMacMapLookup(mgr, data->domain);
@ -59,7 +58,7 @@ testMACLookup(const void *opaque)
fprintf(stderr,
"Unexpected %s in the returned list of MACs\n",
(const char *) next->data);
goto cleanup;
return -1;
}
}
@ -72,13 +71,11 @@ testMACLookup(const void *opaque)
if (!next) {
fprintf(stderr,
"Expected %s in the returned list of MACs\n", data->macs[i]);
goto cleanup;
return -1;
}
}
ret = 0;
cleanup:
return ret;
return 0;
}
@ -90,18 +87,17 @@ testMACRemove(const void *opaque)
GSList *macs;
size_t i;
g_autofree char *file = NULL;
int ret = -1;
file = g_strdup_printf("%s/virmacmaptestdata/%s.json", abs_srcdir, data->file);
if (!(mgr = virMacMapNew(file)))
goto cleanup;
return -1;
for (i = 0; data->macs && data->macs[i]; i++) {
if (virMacMapRemove(mgr, data->domain, data->macs[i]) < 0) {
fprintf(stderr,
"Error when removing %s from the list of MACs\n", data->macs[i]);
goto cleanup;
return -1;
}
}
@ -109,12 +105,10 @@ testMACRemove(const void *opaque)
fprintf(stderr,
"Not removed all MACs for domain %s: %s\n",
data->domain, (const char *) macs->data);
goto cleanup;
return -1;
}
ret = 0;
cleanup:
return ret;
return 0;
}
@ -124,19 +118,16 @@ testMACFlush(const void *opaque)
const struct testData *data = opaque;
g_autofree char *file = NULL;
g_autofree char *str = NULL;
int ret = -1;
file = g_strdup_printf("%s/virmacmaptestdata/%s.json", abs_srcdir, data->file);
if (virMacMapDumpStr(data->mgr, &str) < 0)
goto cleanup;
return -1;
if (virTestCompareToFile(str, file) < 0)
goto cleanup;
return -1;
ret = 0;
cleanup:
return ret;
return 0;
}

View File

@ -37,21 +37,18 @@ static int
testCompareXMLToXMLFiles(const char *expected)
{
g_autofree char *actual = NULL;
int ret = -1;
g_autoptr(virNetworkPortDef) dev = NULL;
if (!(dev = virNetworkPortDefParseFile(expected)))
goto cleanup;
return -1;
if (!(actual = virNetworkPortDefFormat(dev)))
goto cleanup;
return -1;
if (virTestCompareToFile(actual, expected) < 0)
goto cleanup;
return -1;
ret = 0;
cleanup:
return ret;
return 0;
}
struct testInfo {
@ -62,14 +59,12 @@ static int
testCompareXMLToXMLHelper(const void *data)
{
const struct testInfo *info = data;
int ret = -1;
g_autofree char *xml = NULL;
xml = g_strdup_printf("%s/virnetworkportxml2xmldata/%s.xml", abs_srcdir,
info->name);
ret = testCompareXMLToXMLFiles(xml);
return ret;
return testCompareXMLToXMLFiles(xml);
}
static int

View File

@ -162,7 +162,6 @@ virNumaGetPages(int node,
int
virNumaGetNodeCPUs(int node, virBitmap **cpus)
{
int ret = -1;
g_autofree char *cpulist = NULL;
if (virFileReadValueString(&cpulist,
@ -177,9 +176,7 @@ virNumaGetNodeCPUs(int node, virBitmap **cpus)
*cpus = virBitmapParseUnlimited(cpulist);
}
if (!*cpus)
goto cleanup;
return -1;
ret = virBitmapCountBits(*cpus);
cleanup:
return ret;
return virBitmapCountBits(*cpus);
}

View File

@ -34,22 +34,19 @@ testVirPCIDeviceCheckDriver(virPCIDevice *dev, const char *expected)
{
g_autofree char *path = NULL;
g_autofree char *driver = NULL;
int ret = -1;
if (virPCIDeviceGetDriverPathAndName(dev, &path, &driver) < 0)
goto cleanup;
return -1;
if (STRNEQ_NULLABLE(driver, expected)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"PCI device %s driver mismatch: %s, expecting %s",
virPCIDeviceGetName(dev), NULLSTR(driver),
NULLSTR(expected));
goto cleanup;
return -1;
}
ret = 0;
cleanup:
return ret;
return 0;
}
static int

View File

@ -20,7 +20,6 @@ test_virResctrlGetUnused(const void *opaque)
struct virResctrlData *data = (struct virResctrlData *) opaque;
g_autofree char *system_dir = NULL;
g_autofree char *resctrl_dir = NULL;
int ret = -1;
g_autoptr(virResctrlAlloc) alloc = NULL;
g_autofree char *schemata_str = NULL;
g_autofree char *schemata_file = NULL;
@ -41,7 +40,7 @@ test_virResctrlGetUnused(const void *opaque)
caps = virCapabilitiesNew(VIR_ARCH_X86_64, false, false);
if (!caps || virCapabilitiesInitCaches(caps) < 0) {
fprintf(stderr, "Could not initialize capabilities");
goto cleanup;
return -1;
}
alloc = virResctrlAllocGetUnused(caps->host.resctrl);
@ -50,22 +49,19 @@ test_virResctrlGetUnused(const void *opaque)
if (!alloc) {
if (data->fail)
ret = 0;
goto cleanup;
return 0;
return -1;
} else if (data->fail) {
VIR_TEST_DEBUG("Error expected but there wasn't any.");
ret = -1;
goto cleanup;
return -1;
}
schemata_str = virResctrlAllocFormat(alloc);
if (virTestCompareToFile(schemata_str, schemata_file) < 0)
goto cleanup;
return -1;
ret = 0;
cleanup:
return ret;
return 0;
}

View File

@ -37,18 +37,15 @@ static int
test1(const void *data G_GNUC_UNUSED)
{
g_autofree char *name = NULL;
int ret = -1;
if (!(name = virSCSIDeviceGetDevName(virscsi_prefix,
"scsi_host1", 0, 0, 0)))
return -1;
if (STRNEQ(name, "sdh"))
goto cleanup;
return -1;
ret = 0;
cleanup:
return ret;
return 0;
}
/*
@ -161,7 +158,6 @@ test2(const void *data G_GNUC_UNUSED)
static int
create_symlink(const char *tmpdir, const char *src_name, const char *dst_name)
{
int ret = -1;
g_autofree char *src_path = NULL;
g_autofree char *dst_path = NULL;
@ -171,13 +167,10 @@ create_symlink(const char *tmpdir, const char *src_name, const char *dst_name)
if (symlink(src_path, dst_path) < 0) {
VIR_WARN("Failed to create symlink '%s' to '%s'", src_path, dst_path);
goto cleanup;
return -1;
}
ret = 0;
cleanup:
return ret;
return 0;
}
static int

View File

@ -223,7 +223,6 @@ testStringReplace(const void *opaque G_GNUC_UNUSED)
{
const struct stringReplaceData *data = opaque;
g_autofree char *result = NULL;
int ret = -1;
result = virStringReplace(data->haystack,
data->oldneedle,
@ -232,13 +231,10 @@ testStringReplace(const void *opaque G_GNUC_UNUSED)
if (STRNEQ_NULLABLE(data->result, result)) {
fprintf(stderr, "Expected '%s' but got '%s'\n",
data->result, NULLSTR(result));
goto cleanup;
return -1;
}
ret = 0;
cleanup:
return ret;
return 0;
}
@ -400,7 +396,6 @@ struct testStripData {
static int testStripIPv6Brackets(const void *args)
{
const struct testStripData *data = args;
int ret = -1;
g_autofree char *res = NULL;
res = g_strdup(data->string);
@ -410,19 +405,15 @@ static int testStripIPv6Brackets(const void *args)
if (STRNEQ_NULLABLE(res, data->result)) {
fprintf(stderr, "Returned '%s', expected '%s'\n",
NULLSTR(res), NULLSTR(data->result));
goto cleanup;
return -1;
}
ret = 0;
cleanup:
return ret;
return 0;
}
static int testStripControlChars(const void *args)
{
const struct testStripData *data = args;
int ret = -1;
g_autofree char *res = NULL;
res = g_strdup(data->string);
@ -432,13 +423,10 @@ static int testStripControlChars(const void *args)
if (STRNEQ_NULLABLE(res, data->result)) {
fprintf(stderr, "Returned '%s', expected '%s'\n",
NULLSTR(res), NULLSTR(data->result));
goto cleanup;
return -1;
}
ret = 0;
cleanup:
return ret;
return 0;
}
struct testFilterData {
@ -450,7 +438,6 @@ struct testFilterData {
static int testFilterChars(const void *args)
{
const struct testFilterData *data = args;
int ret = -1;
g_autofree char *res = NULL;
res = g_strdup(data->string);
@ -460,13 +447,10 @@ static int testFilterChars(const void *args)
if (STRNEQ_NULLABLE(res, data->result)) {
fprintf(stderr, "Returned '%s', expected '%s'\n",
NULLSTR(res), NULLSTR(data->result));
goto cleanup;
return -1;
}
ret = 0;
cleanup:
return ret;
return 0;
}
static int

View File

@ -369,45 +369,37 @@ static int
testScopeName(const void *opaque)
{
const struct testNameData *data = opaque;
int ret = -1;
g_autofree char *actual = NULL;
if (!(actual = virSystemdMakeScopeName(data->name, "lxc", data->legacy)))
goto cleanup;
return -1;
if (STRNEQ(actual, data->expected)) {
fprintf(stderr, "Expected '%s' but got '%s'\n",
data->expected, actual);
goto cleanup;
return -1;
}
ret = 0;
cleanup:
return ret;
return 0;
}
static int
testMachineName(const void *opaque)
{
const struct testNameData *data = opaque;
int ret = -1;
g_autofree char *actual = NULL;
if (!(actual = virDomainDriverGenerateMachineName("qemu", data->root,
data->id, data->name, true)))
goto cleanup;
return -1;
if (STRNEQ(actual, data->expected)) {
fprintf(stderr, "Expected '%s' but got '%s'\n",
data->expected, actual);
goto cleanup;
return -1;
}
ret = 0;
cleanup:
return ret;
return 0;
}
typedef int (*virSystemdCanHelper)(bool * result);