提交 2b50a11a 编写于 作者: P Pavel Hrdina

tests: use global virQEMUDriver

Most tests already use global driver variable that is initialized
before any test case is executed, convert these remaining tests to
the same concept.
Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
上级 060de835
...@@ -31,6 +31,10 @@ ...@@ -31,6 +31,10 @@
#define VIR_FROM_THIS VIR_FROM_NONE #define VIR_FROM_THIS VIR_FROM_NONE
virQEMUDriver driver;
static int static int
testQemuAgentFSFreeze(const void *data) testQemuAgentFSFreeze(const void *data)
{ {
...@@ -167,7 +171,6 @@ static int ...@@ -167,7 +171,6 @@ static int
testQemuAgentGetFSInfo(const void *data) testQemuAgentGetFSInfo(const void *data)
{ {
virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data; virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
virCapsPtr caps = testQemuCapsInit();
qemuMonitorTestPtr test = qemuMonitorTestNewAgent(xmlopt); qemuMonitorTestPtr test = qemuMonitorTestNewAgent(xmlopt);
char *domain_filename = NULL; char *domain_filename = NULL;
virDomainDefPtr def = NULL; virDomainDefPtr def = NULL;
...@@ -181,7 +184,7 @@ testQemuAgentGetFSInfo(const void *data) ...@@ -181,7 +184,7 @@ testQemuAgentGetFSInfo(const void *data)
abs_srcdir) < 0) abs_srcdir) < 0)
goto cleanup; goto cleanup;
if (!(def = virDomainDefParseFile(domain_filename, caps, xmlopt, if (!(def = virDomainDefParseFile(domain_filename, driver.caps, xmlopt,
NULL, VIR_DOMAIN_DEF_PARSE_INACTIVE))) NULL, VIR_DOMAIN_DEF_PARSE_INACTIVE)))
goto cleanup; goto cleanup;
...@@ -293,7 +296,6 @@ testQemuAgentGetFSInfo(const void *data) ...@@ -293,7 +296,6 @@ testQemuAgentGetFSInfo(const void *data)
virDomainFSInfoFree(info[i]); virDomainFSInfoFree(info[i]);
VIR_FREE(info); VIR_FREE(info);
VIR_FREE(domain_filename); VIR_FREE(domain_filename);
virObjectUnref(caps);
virDomainDefFree(def); virDomainDefFree(def);
qemuMonitorTestFree(test); qemuMonitorTestFree(test);
return ret; return ret;
...@@ -903,7 +905,6 @@ testQemuAgentGetInterfaces(const void *data) ...@@ -903,7 +905,6 @@ testQemuAgentGetInterfaces(const void *data)
static int static int
mymain(void) mymain(void)
{ {
virQEMUDriver driver;
int ret = 0; int ret = 0;
#if !WITH_YAJL #if !WITH_YAJL
......
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
VIR_LOG_INIT("tests.securityselinuxlabeltest"); VIR_LOG_INIT("tests.securityselinuxlabeltest");
static virCapsPtr caps;
static virQEMUDriver driver; static virQEMUDriver driver;
static virSecurityManagerPtr mgr; static virSecurityManagerPtr mgr;
...@@ -189,7 +188,8 @@ testSELinuxLoadDef(const char *testname) ...@@ -189,7 +188,8 @@ testSELinuxLoadDef(const char *testname)
abs_srcdir, testname) < 0) abs_srcdir, testname) < 0)
goto cleanup; goto cleanup;
if (!(def = virDomainDefParseFile(xmlfile, caps, driver.xmlopt, NULL, 0))) if (!(def = virDomainDefParseFile(xmlfile, driver.caps, driver.xmlopt,
NULL, 0)))
goto cleanup; goto cleanup;
for (i = 0; i < def->ndisks; i++) { for (i = 0; i < def->ndisks; i++) {
...@@ -357,9 +357,6 @@ mymain(void) ...@@ -357,9 +357,6 @@ mymain(void)
return EXIT_FAILURE; return EXIT_FAILURE;
} }
if ((caps = testQemuCapsInit()) == NULL)
return EXIT_FAILURE;
if (qemuTestDriverInit(&driver) < 0) if (qemuTestDriverInit(&driver) < 0)
return EXIT_FAILURE; return EXIT_FAILURE;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册