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
virQEMUDriver driver;
static int
testQemuAgentFSFreeze(const void *data)
{
@ -167,7 +171,6 @@ static int
testQemuAgentGetFSInfo(const void *data)
{
virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
virCapsPtr caps = testQemuCapsInit();
qemuMonitorTestPtr test = qemuMonitorTestNewAgent(xmlopt);
char *domain_filename = NULL;
virDomainDefPtr def = NULL;
@ -181,7 +184,7 @@ testQemuAgentGetFSInfo(const void *data)
abs_srcdir) < 0)
goto cleanup;
if (!(def = virDomainDefParseFile(domain_filename, caps, xmlopt,
if (!(def = virDomainDefParseFile(domain_filename, driver.caps, xmlopt,
NULL, VIR_DOMAIN_DEF_PARSE_INACTIVE)))
goto cleanup;
@ -293,7 +296,6 @@ testQemuAgentGetFSInfo(const void *data)
virDomainFSInfoFree(info[i]);
VIR_FREE(info);
VIR_FREE(domain_filename);
virObjectUnref(caps);
virDomainDefFree(def);
qemuMonitorTestFree(test);
return ret;
@ -903,7 +905,6 @@ testQemuAgentGetInterfaces(const void *data)
static int
mymain(void)
{
virQEMUDriver driver;
int ret = 0;
#if !WITH_YAJL

View File

@ -45,7 +45,6 @@
VIR_LOG_INIT("tests.securityselinuxlabeltest");
static virCapsPtr caps;
static virQEMUDriver driver;
static virSecurityManagerPtr mgr;
@ -189,7 +188,8 @@ testSELinuxLoadDef(const char *testname)
abs_srcdir, testname) < 0)
goto cleanup;
if (!(def = virDomainDefParseFile(xmlfile, caps, driver.xmlopt, NULL, 0)))
if (!(def = virDomainDefParseFile(xmlfile, driver.caps, driver.xmlopt,
NULL, 0)))
goto cleanup;
for (i = 0; i < def->ndisks; i++) {
@ -357,9 +357,6 @@ mymain(void)
return EXIT_FAILURE;
}
if ((caps = testQemuCapsInit()) == NULL)
return EXIT_FAILURE;
if (qemuTestDriverInit(&driver) < 0)
return EXIT_FAILURE;