diff --git a/tests/qemucapabilitiestest.c b/tests/qemucapabilitiestest.c index 0fbc43c90a..99abd02e1d 100644 --- a/tests/qemucapabilitiestest.c +++ b/tests/qemucapabilitiestest.c @@ -160,7 +160,7 @@ static int mymain(void) { int ret = 0; - virDomainXMLOptionPtr xmlopt; + virQEMUDriver driver; testQemuData data; #if !WITH_YAJL @@ -169,12 +169,12 @@ mymain(void) #endif if (virThreadInitialize() < 0 || - !(xmlopt = virQEMUDriverCreateXMLConf(NULL))) + qemuTestDriverInit(&driver) < 0) return EXIT_FAILURE; virEventRegisterDefaultImpl(); - data.xmlopt = xmlopt; + data.xmlopt = driver.xmlopt; #define DO_TEST(name) \ do { \ @@ -191,7 +191,8 @@ mymain(void) DO_TEST("caps_1.6.50-1"); DO_TEST("caps_2.1.1-1"); - virObjectUnref(xmlopt); + qemuTestDriverFree(&driver); + return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index ded04234ff..7d4741e4a7 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2238,7 +2238,7 @@ static int mymain(void) { int ret = 0; - virDomainXMLOptionPtr xmlopt; + virQEMUDriver driver; testQemuMonitorJSONSimpleFuncData simpleFunc; #if !WITH_YAJL @@ -2247,29 +2247,30 @@ mymain(void) #endif if (virThreadInitialize() < 0 || - !(xmlopt = virQEMUDriverCreateXMLConf(NULL))) + qemuTestDriverInit(&driver) < 0) return EXIT_FAILURE; virEventRegisterDefaultImpl(); -#define DO_TEST(name) \ - if (virtTestRun(# name, testQemuMonitorJSON ## name, xmlopt) < 0) \ +#define DO_TEST(name) \ + if (virtTestRun(# name, testQemuMonitorJSON ## name, driver.xmlopt) < 0) \ ret = -1 #define DO_TEST_SIMPLE(CMD, FNC, ...) \ simpleFunc = (testQemuMonitorJSONSimpleFuncData) {.cmd = CMD, .func = FNC, \ - .xmlopt = xmlopt, __VA_ARGS__ }; \ + .xmlopt = driver.xmlopt, __VA_ARGS__ }; \ if (virtTestRun(# FNC, testQemuMonitorJSONSimpleFunc, &simpleFunc) < 0) \ ret = -1 #define DO_TEST_GEN(name, ...) \ - simpleFunc = (testQemuMonitorJSONSimpleFuncData) {.xmlopt = xmlopt, __VA_ARGS__ }; \ - if (virtTestRun(# name, testQemuMonitorJSON ## name, &simpleFunc) < 0) \ + simpleFunc = (testQemuMonitorJSONSimpleFuncData) {.xmlopt = driver.xmlopt, \ + __VA_ARGS__ }; \ + if (virtTestRun(# name, testQemuMonitorJSON ## name, &simpleFunc) < 0) \ ret = -1 #define DO_TEST_CPU_DATA(name) \ do { \ - struct testCPUData data = { name, xmlopt }; \ + struct testCPUData data = { name, driver.xmlopt }; \ const char *label = "GetCPUData(" name ")"; \ if (virtTestRun(label, testQemuMonitorJSONGetCPUData, &data) < 0) \ ret = -1; \ @@ -2347,7 +2348,7 @@ mymain(void) DO_TEST_CPU_DATA("host"); DO_TEST_CPU_DATA("full"); - virObjectUnref(xmlopt); + qemuTestDriverFree(&driver); return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } diff --git a/tests/qemumonitortest.c b/tests/qemumonitortest.c index 12308f9c35..324021a2f7 100644 --- a/tests/qemumonitortest.c +++ b/tests/qemumonitortest.c @@ -14,6 +14,7 @@ # include "qemu/qemu_monitor.h" # include "qemu/qemu_monitor_text.h" # include "qemumonitortestutils.h" +# include "testutilsqemu.h" # define VIR_FROM_THIS VIR_FROM_NONE @@ -164,11 +165,11 @@ testMonitorTextBlockInfo(const void *opaque) static int mymain(void) { - virDomainXMLOptionPtr xmlopt; + virQEMUDriver driver; int result = 0; if (virThreadInitialize() < 0 || - !(xmlopt = virQEMUDriverCreateXMLConf(NULL))) + qemuTestDriverInit(&driver) < 0) return EXIT_FAILURE; virEventRegisterDefaultImpl(); @@ -176,7 +177,7 @@ mymain(void) # define DO_TEST(_name) \ do { \ if (virtTestRun("qemu monitor "#_name, test##_name, \ - xmlopt) < 0) { \ + driver.xmlopt) < 0) { \ result = -1; \ } \ } while (0) @@ -185,7 +186,7 @@ mymain(void) DO_TEST(UnescapeArg); DO_TEST(MonitorTextBlockInfo); - virObjectUnref(xmlopt); + qemuTestDriverFree(&driver); return result == 0 ? EXIT_SUCCESS : EXIT_FAILURE; } diff --git a/tests/securityselinuxlabeltest.c b/tests/securityselinuxlabeltest.c index 4808eea386..4b8fa6f25e 100644 --- a/tests/securityselinuxlabeltest.c +++ b/tests/securityselinuxlabeltest.c @@ -46,7 +46,7 @@ VIR_LOG_INIT("tests.securityselinuxlabeltest"); static virCapsPtr caps; -static virDomainXMLOptionPtr xmlopt; +static virQEMUDriver driver; static virSecurityManagerPtr mgr; @@ -189,7 +189,7 @@ testSELinuxLoadDef(const char *testname) abs_srcdir, testname) < 0) goto cleanup; - if (!(def = virDomainDefParseFile(xmlfile, caps, xmlopt, 0))) + if (!(def = virDomainDefParseFile(xmlfile, caps, driver.xmlopt, 0))) goto cleanup; for (i = 0; i < def->ndisks; i++) { @@ -361,7 +361,7 @@ mymain(void) if ((caps = testQemuCapsInit()) == NULL) return EXIT_FAILURE; - if (!(xmlopt = virQEMUDriverCreateXMLConf(NULL))) + if (qemuTestDriverInit(&driver) < 0) return EXIT_FAILURE; #define DO_TEST_LABELING(name) \ @@ -375,6 +375,8 @@ mymain(void) DO_TEST_LABELING("chardev"); DO_TEST_LABELING("nfs"); + qemuTestDriverFree(&driver); + return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE; }