1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

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: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Pavel Hrdina 2016-12-19 23:35:02 +01:00
parent 060de8357a
commit 2b50a11acb
2 changed files with 7 additions and 9 deletions

View File

@ -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
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)
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)
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)
static int static int
mymain(void) mymain(void)
{ {
virQEMUDriver driver;
int ret = 0; int ret = 0;
#if !WITH_YAJL #if !WITH_YAJL

View File

@ -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)
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)
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;