mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
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:
parent
31044d6ff2
commit
c125a6ef2a
@ -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)
|
||||
|
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user