tests: Move ret into testQemuData

This is not particularly useful right now, but will allow us
to refactor some functionality later on.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Andrea Bolognani 2019-03-07 14:24:14 +01:00
parent 31044d6ff2
commit c125a6ef2a
2 changed files with 12 additions and 9 deletions

View File

@ -37,6 +37,7 @@ struct _testQemuData {
virQEMUDriver driver;
const char *archName;
const char *base;
int ret;
};
@ -46,6 +47,8 @@ testQemuDataInit(testQemuDataPtr data)
if (qemuTestDriverInit(&data->driver) < 0)
return -1;
data->ret = 0;
return 0;
}
@ -173,7 +176,6 @@ testQemuCapsCopy(const void *opaque)
static int
mymain(void)
{
int ret = 0;
testQemuData data;
#if !WITH_YAJL
@ -194,10 +196,10 @@ mymain(void)
data.archName = arch; \
data.base = name; \
if (virTestRun(name "(" arch ")", testQemuCaps, &data) < 0) \
ret = -1; \
data.ret = -1; \
if (virTestRun("copy " name "(" arch ")", \
testQemuCapsCopy, &data) < 0) \
ret = -1; \
data.ret = -1; \
} while (0)
/* Keep this in sync with qemucaps2xmltest */
@ -248,7 +250,7 @@ mymain(void)
testQemuDataReset(&data);
return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
return (data.ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
VIR_TEST_MAIN(mymain)

View File

@ -30,11 +30,14 @@ typedef testQemuData *testQemuDataPtr;
struct _testQemuData {
const char *base;
const char *archName;
int ret;
};
static int
testQemuDataInit(testQemuDataPtr data ATTRIBUTE_UNUSED)
testQemuDataInit(testQemuDataPtr data)
{
data->ret = 0;
return 0;
}
@ -168,8 +171,6 @@ testQemuCapsXML(const void *opaque)
static int
mymain(void)
{
int ret = 0;
testQemuData data;
#if !WITH_YAJL
@ -189,7 +190,7 @@ mymain(void)
data.archName = arch; \
data.base = name; \
if (virTestRun(name "(" arch ")", testQemuCapsXML, &data) < 0) \
ret = -1
data.ret = -1
/* Keep this in sync with qemucapabilitiestest */
DO_TEST("x86_64", "caps_1.5.3");
@ -229,7 +230,7 @@ mymain(void)
DO_TEST("riscv64", "caps_3.0.0");
DO_TEST("riscv64", "caps_4.0.0");
return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
return (data.ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/qemucaps2xmlmock.so")