This is not particularly useful right now, but will allow us to refactor some functionality later on. Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx> --- tests/qemucapabilitiestest.c | 10 ++++++---- tests/qemucaps2xmltest.c | 11 ++++++----- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/tests/qemucapabilitiestest.c b/tests/qemucapabilitiestest.c index 882fa57485..0f875f9e24 100644 --- a/tests/qemucapabilitiestest.c +++ b/tests/qemucapabilitiestest.c @@ -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) diff --git a/tests/qemucaps2xmltest.c b/tests/qemucaps2xmltest.c index 5cc9fb635b..e9b0b11e35 100644 --- a/tests/qemucaps2xmltest.c +++ b/tests/qemucaps2xmltest.c @@ -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; } @@ -173,8 +176,6 @@ testQemuCapsXML(const void *opaque) static int mymain(void) { - int ret = 0; - testQemuData data; #if !WITH_YAJL @@ -194,7 +195,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"); @@ -236,7 +237,7 @@ mymain(void) testQemuDataReset(&data); - 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") -- 2.20.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list