[PATCH 3/8] tests: use global virQEMUDriver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 tests/qemuagenttest.c            | 9 +++++----
 tests/securityselinuxlabeltest.c | 7 ++-----
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/tests/qemuagenttest.c b/tests/qemuagenttest.c
index 41a0196c46..af7c936c8b 100644
--- a/tests/qemuagenttest.c
+++ b/tests/qemuagenttest.c
@@ -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
diff --git a/tests/securityselinuxlabeltest.c b/tests/securityselinuxlabeltest.c
index d4ef9831ad..3e134991f2 100644
--- a/tests/securityselinuxlabeltest.c
+++ b/tests/securityselinuxlabeltest.c
@@ -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;
 
-- 
2.12.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux