[PATCHv3 09/27] fix fallout in tests/

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

 



---
 tests/domainsnapshotxml2xmltest.c |  5 +++++
 tests/lxcxml2xmltest.c            |  7 ++++++-
 tests/qemuargv2xmltest.c          |  8 ++++++--
 tests/qemumonitorjsontest.c       | 29 +++++++++++++++--------------
 tests/qemumonitortestutils.c      |  4 ++--
 tests/qemumonitortestutils.h      |  5 +++--
 tests/qemuxml2argvtest.c          |  5 ++++-
 tests/qemuxml2xmltest.c           |  6 +++++-
 tests/qemuxmlnstest.c             |  5 ++++-
 tests/testutilsqemu.c             |  3 +--
 tests/testutilsqemu.h             |  2 ++
 tests/testutilsxen.c              |  6 ++++++
 tests/testutilsxen.h              |  2 ++
 tests/xmconfigtest.c              |  8 +++++++-
 tests/xml2sexprtest.c             |  8 +++++++-
 tests/xml2vmxtest.c               |  8 +++++++-
 16 files changed, 82 insertions(+), 29 deletions(-)

diff --git a/tests/domainsnapshotxml2xmltest.c b/tests/domainsnapshotxml2xmltest.c
index aeea997..7d95310 100644
--- a/tests/domainsnapshotxml2xmltest.c
+++ b/tests/domainsnapshotxml2xmltest.c
@@ -34,6 +34,7 @@ testCompareXMLToXMLFiles(const char *inxml, const char *uuid, int internal)
     if (internal)
         flags |= VIR_DOMAIN_SNAPSHOT_PARSE_INTERNAL;
     if (!(def = virDomainSnapshotDefParseString(inXmlData, driver.caps,
+                                                driver.xmlconf,
                                                 QEMU_EXPECTED_VIRT_TYPES,
                                                 flags)))
         goto fail;
@@ -90,6 +91,9 @@ mymain(void)
     if ((driver.caps = testQemuCapsInit()) == NULL)
         return EXIT_FAILURE;

+    if (!(driver.xmlconf = virQEMUDriverCreateXMLConf()))
+        return EXIT_FAILURE;
+
 # define DO_TEST(name, uuid, internal)                                  \
     do {                                                                \
         const struct testInfo info = {name, uuid, internal};            \
@@ -113,6 +117,7 @@ mymain(void)
     DO_TEST("external_vm", "c7a5fdbd-edaf-9455-926a-d65c16db1809", 0);

     virObjectUnref(driver.caps);
+    virObjectUnref(driver.xmlconf);

     return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }
diff --git a/tests/lxcxml2xmltest.c b/tests/lxcxml2xmltest.c
index bfb6092..964d433 100644
--- a/tests/lxcxml2xmltest.c
+++ b/tests/lxcxml2xmltest.c
@@ -16,6 +16,7 @@
 # include "testutilslxc.h"

 static virCapsPtr caps;
+static virDomainXMLConfPtr xmlconf;

 static int
 testCompareXMLToXMLFiles(const char *inxml, const char *outxml, bool live)
@@ -31,7 +32,7 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml, bool live)
     if (virtTestLoadFile(outxml, &outXmlData) < 0)
         goto fail;

-    if (!(def = virDomainDefParseString(caps, inXmlData,
+    if (!(def = virDomainDefParseString(caps, xmlconf, inXmlData,
                                         1 << VIR_DOMAIN_VIRT_LXC,
                                         live ? 0 : VIR_DOMAIN_XML_INACTIVE)))
         goto fail;
@@ -101,6 +102,9 @@ mymain(void)
     if ((caps = testLXCCapsInit()) == NULL)
         return EXIT_FAILURE;

+    if (!(xmlconf = lxcDomainXMLConfInit()))
+        return EXIT_FAILURE;
+
 # define DO_TEST_FULL(name, is_different, inactive)                     \
     do {                                                                \
         const struct testInfo info = {name, is_different, inactive};    \
@@ -124,6 +128,7 @@ mymain(void)
     DO_TEST("hostdev");

     virObjectUnref(caps);
+    virObjectUnref(xmlconf);

     return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }
diff --git a/tests/qemuargv2xmltest.c b/tests/qemuargv2xmltest.c
index 3c23010..f7d6019 100644
--- a/tests/qemuargv2xmltest.c
+++ b/tests/qemuargv2xmltest.c
@@ -46,8 +46,8 @@ static int testCompareXMLToArgvFiles(const char *xml,
     if (virtTestLoadFile(xml, &expectxml) < 0)
         goto fail;

-    if (!(vmdef = qemuParseCommandLineString(driver.caps, cmd,
-                                             NULL, NULL, NULL)))
+    if (!(vmdef = qemuParseCommandLineString(driver.caps, driver.xmlconf,
+                                             cmd, NULL, NULL, NULL)))
         goto fail;

     if ((log = virtTestLogContentAndReset()) == NULL)
@@ -120,6 +120,9 @@ mymain(void)
     if ((driver.caps = testQemuCapsInit()) == NULL)
         return EXIT_FAILURE;

+    if (!(driver.xmlconf = virQEMUDriverCreateXMLConf()))
+        return EXIT_FAILURE;
+
 # define DO_TEST_FULL(name, extraFlags, migrateFrom)                     \
     do {                                                                \
         const struct testInfo info = { name, extraFlags, migrateFrom }; \
@@ -244,6 +247,7 @@ mymain(void)

     virObjectUnref(driver.config);
     virObjectUnref(driver.caps);
+    virObjectUnref(driver.xmlconf);

     return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index 04b8f77..639eeb1 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -22,6 +22,7 @@
 #include "testutils.h"
 #include "testutilsqemu.h"
 #include "qemumonitortestutils.h"
+#include "qemu/qemu_conf.h"
 #include "virthread.h"
 #include "virerror.h"

@@ -31,8 +32,8 @@
 static int
 testQemuMonitorJSONGetStatus(const void *data)
 {
-    virCapsPtr caps = (virCapsPtr)data;
-    qemuMonitorTestPtr test = qemuMonitorTestNew(true, caps);
+    virDomainXMLConfPtr xmlconf = (virDomainXMLConfPtr)data;
+    qemuMonitorTestPtr test = qemuMonitorTestNew(true, xmlconf);
     int ret = -1;
     bool running = false;
     virDomainPausedReason reason = 0;
@@ -125,8 +126,8 @@ cleanup:
 static int
 testQemuMonitorJSONGetVersion(const void *data)
 {
-    virCapsPtr caps = (virCapsPtr)data;
-    qemuMonitorTestPtr test = qemuMonitorTestNew(true, caps);
+    virDomainXMLConfPtr xmlconf = (virDomainXMLConfPtr)data;
+    qemuMonitorTestPtr test = qemuMonitorTestNew(true, xmlconf);
     int ret = -1;
     int major;
     int minor;
@@ -228,8 +229,8 @@ cleanup:
 static int
 testQemuMonitorJSONGetMachines(const void *data)
 {
-    virCapsPtr caps = (virCapsPtr)data;
-    qemuMonitorTestPtr test = qemuMonitorTestNew(true, caps);
+    virDomainXMLConfPtr xmlconf = (virDomainXMLConfPtr)data;
+    qemuMonitorTestPtr test = qemuMonitorTestNew(true, xmlconf);
     int ret = -1;
     qemuMonitorMachineInfoPtr *info;
     int ninfo = 0;
@@ -310,8 +311,8 @@ cleanup:
 static int
 testQemuMonitorJSONGetCPUDefinitions(const void *data)
 {
-    virCapsPtr caps = (virCapsPtr)data;
-    qemuMonitorTestPtr test = qemuMonitorTestNew(true, caps);
+    virDomainXMLConfPtr xmlconf = (virDomainXMLConfPtr)data;
+    qemuMonitorTestPtr test = qemuMonitorTestNew(true, xmlconf);
     int ret = -1;
     char **cpus = NULL;
     int ncpus = 0;
@@ -376,8 +377,8 @@ cleanup:
 static int
 testQemuMonitorJSONGetCommands(const void *data)
 {
-    virCapsPtr caps = (virCapsPtr)data;
-    qemuMonitorTestPtr test = qemuMonitorTestNew(true, caps);
+    virDomainXMLConfPtr xmlconf = (virDomainXMLConfPtr)data;
+    qemuMonitorTestPtr test = qemuMonitorTestNew(true, xmlconf);
     int ret = -1;
     char **commands = NULL;
     int ncommands = 0;
@@ -442,7 +443,7 @@ static int
 mymain(void)
 {
     int ret = 0;
-    virCapsPtr caps;
+    virDomainXMLConfPtr xmlconf;

 #if !WITH_YAJL
     fputs("libvirt not compiled with yajl, skipping this test\n", stderr);
@@ -450,13 +451,13 @@ mymain(void)
 #endif

     if (virThreadInitialize() < 0 ||
-        !(caps = testQemuCapsInit()))
+        !(xmlconf = virQEMUDriverCreateXMLConf()))
         return EXIT_FAILURE;

     virEventRegisterDefaultImpl();

 #define DO_TEST(name) \
-    if (virtTestRun(# name, 1, testQemuMonitorJSON ## name, caps) < 0) \
+    if (virtTestRun(# name, 1, testQemuMonitorJSON ## name, xmlconf) < 0) \
         ret = -1

     DO_TEST(GetStatus);
@@ -465,7 +466,7 @@ mymain(void)
     DO_TEST(GetCPUDefinitions);
     DO_TEST(GetCommands);

-    virObjectUnref(caps);
+    virObjectUnref(xmlconf);

     return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
 }
diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c
index 979623a..d5bce84 100644
--- a/tests/qemumonitortestutils.c
+++ b/tests/qemumonitortestutils.c
@@ -450,7 +450,7 @@ static qemuMonitorCallbacks qemuCallbacks = {

 #define QEMU_TEXT_GREETING "QEMU 1.0,1 monitor - type 'help' for more information"

-qemuMonitorTestPtr qemuMonitorTestNew(bool json, virCapsPtr caps)
+qemuMonitorTestPtr qemuMonitorTestNew(bool json, virDomainXMLConfPtr xmlconf)
 {
     qemuMonitorTestPtr test = NULL;
     virDomainChrSourceDef src;
@@ -482,7 +482,7 @@ qemuMonitorTestPtr qemuMonitorTestNew(bool json, virCapsPtr caps)
         goto no_memory;

     test->json = json;
-    if (!(test->vm = virDomainObjNew(caps)))
+    if (!(test->vm = virDomainObjNew(xmlconf)))
         goto error;

     if (virNetSocketNewListenUNIX(path,
diff --git a/tests/qemumonitortestutils.h b/tests/qemumonitortestutils.h
index edad103..09914ae 100644
--- a/tests/qemumonitortestutils.h
+++ b/tests/qemumonitortestutils.h
@@ -20,7 +20,7 @@
 #ifndef __VIR_QEMU_MONITOR_TEST_UTILS_H__
 # define __VIR_QEMU_MONITOR_TEST_UTILS_H__

-# include "capabilities.h"
+# include "domain_conf.h"
 # include "qemu/qemu_monitor.h"

 typedef struct _qemuMonitorTest qemuMonitorTest;
@@ -32,7 +32,8 @@ qemuMonitorTestAddItem(qemuMonitorTestPtr test,
                        const char *response);

 qemuMonitorTestPtr qemuMonitorTestNew(bool json,
-                                      virCapsPtr caps);
+                                      virDomainXMLConfPtr xmlconf);
+

 void qemuMonitorTestFree(qemuMonitorTestPtr test);

diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 2354733..888de3c 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -100,7 +100,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
         goto out;
     conn->secretDriver = &fakeSecretDriver;

-    if (!(vmdef = virDomainDefParseFile(driver.caps, xml,
+    if (!(vmdef = virDomainDefParseFile(driver.caps, driver.xmlconf, xml,
                                         QEMU_EXPECTED_VIRT_TYPES,
                                         VIR_DOMAIN_XML_INACTIVE))) {
         if (flags & FLAG_EXPECT_PARSE_ERROR)
@@ -294,6 +294,8 @@ mymain(void)

     if ((driver.caps = testQemuCapsInit()) == NULL)
         return EXIT_FAILURE;
+    if (!(driver.xmlconf = virQEMUDriverCreateXMLConf()))
+        return EXIT_FAILURE;
     VIR_FREE(driver.config->stateDir);
     if ((driver.config->stateDir = strdup("/nowhere")) == NULL)
         return EXIT_FAILURE;
@@ -891,6 +893,7 @@ mymain(void)

     virObjectUnref(driver.config);
     virObjectUnref(driver.caps);
+    virObjectUnref(driver.xmlconf);
     VIR_FREE(map);

     return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index d64960f..d77da4e 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -32,7 +32,7 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml, bool live)
     if (virtTestLoadFile(outxml, &outXmlData) < 0)
         goto fail;

-    if (!(def = virDomainDefParseString(driver.caps, inXmlData,
+    if (!(def = virDomainDefParseString(driver.caps, driver.xmlconf, inXmlData,
                                         QEMU_EXPECTED_VIRT_TYPES,
                                         live ? 0 : VIR_DOMAIN_XML_INACTIVE)))
         goto fail;
@@ -106,6 +106,9 @@ mymain(void)
     if ((driver.caps = testQemuCapsInit()) == NULL)
         return EXIT_FAILURE;

+    if (!(driver.xmlconf = virQEMUDriverCreateXMLConf()))
+        return EXIT_FAILURE;
+
 # define DO_TEST_FULL(name, is_different, when)                         \
     do {                                                                \
         const struct testInfo info = {name, is_different, when};        \
@@ -262,6 +265,7 @@ mymain(void)
     DO_TEST_DIFFERENT("metadata");

     virObjectUnref(driver.caps);
+    virObjectUnref(driver.xmlconf);

     return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }
diff --git a/tests/qemuxmlnstest.c b/tests/qemuxmlnstest.c
index 6dae3f4..76a715d 100644
--- a/tests/qemuxmlnstest.c
+++ b/tests/qemuxmlnstest.c
@@ -51,7 +51,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
     if (len && expectargv[len - 1] == '\n')
         expectargv[len - 1] = '\0';

-    if (!(vmdef = virDomainDefParseFile(driver.caps, xml,
+    if (!(vmdef = virDomainDefParseFile(driver.caps, driver.xmlconf, xml,
                                         QEMU_EXPECTED_VIRT_TYPES,
                                         VIR_DOMAIN_XML_INACTIVE)))
         goto fail;
@@ -204,6 +204,8 @@ mymain(void)
     driver.config = virQEMUDriverConfigNew(false);
     if ((driver.caps = testQemuCapsInit()) == NULL)
         return EXIT_FAILURE;
+    if (!(driver.xmlconf = virQEMUDriverCreateXMLConf()))
+        return EXIT_FAILURE;
     if (virAsprintf(&map, "%s/src/cpu/cpu_map.xml", abs_top_srcdir) < 0 ||
         cpuMapOverride(map) < 0) {
         VIR_FREE(map);
@@ -252,6 +254,7 @@ mymain(void)

     virObjectUnref(driver.config);
     virObjectUnref(driver.caps);
+    virObjectUnref(driver.xmlconf);
     VIR_FREE(map);

     return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index 966527c..27cf647 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -120,6 +120,7 @@ error:
     return -1;
 }

+
 virCapsPtr testQemuCapsInit(void) {
     virCapsPtr caps;
     virCapsGuestPtr guest;
@@ -174,8 +175,6 @@ virCapsPtr testQemuCapsInit(void) {
         (machines = testQemuAllocMachines(&nmachines)) == NULL)
         goto cleanup;

-    qemuDomainSetNamespaceHooks(caps);
-
     if ((guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_I686,
                                          "/usr/bin/qemu", NULL,
                                          nmachines, machines)) == NULL ||
diff --git a/tests/testutilsqemu.h b/tests/testutilsqemu.h
index 3d70a2a..932becb 100644
--- a/tests/testutilsqemu.h
+++ b/tests/testutilsqemu.h
@@ -1,4 +1,6 @@

 #include "capabilities.h"
+#include "domain_conf.h"

 virCapsPtr testQemuCapsInit(void);
+virDomainXMLConfPtr testQemuXMLConfInit(void);
diff --git a/tests/testutilsxen.c b/tests/testutilsxen.c
index 6d97925..201ea2a 100644
--- a/tests/testutilsxen.c
+++ b/tests/testutilsxen.c
@@ -15,6 +15,12 @@ static int testXenDefaultConsoleType(const char *ostype,
         return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN;
 }

+virDomainXMLConfPtr
+testXenXMLConfInit(void)
+{
+    return virDomainXMLConfNew(NULL, NULL);
+}
+
 virCapsPtr testXenCapsInit(void) {
     struct utsname utsname;
     virCapsPtr caps;
diff --git a/tests/testutilsxen.h b/tests/testutilsxen.h
index 7f27e22..d4576cb 100644
--- a/tests/testutilsxen.h
+++ b/tests/testutilsxen.h
@@ -1,4 +1,6 @@

 #include "capabilities.h"
+#include "domain_conf.h"

 virCapsPtr testXenCapsInit(void);
+virDomainXMLConfPtr testXenXMLConfInit(void);
diff --git a/tests/xmconfigtest.c b/tests/xmconfigtest.c
index 9f71aa2..a32c11a 100644
--- a/tests/xmconfigtest.c
+++ b/tests/xmconfigtest.c
@@ -37,6 +37,7 @@
 #include "viralloc.h"

 static virCapsPtr caps;
+static virDomainXMLConfPtr xmlconf;

 static int
 testCompareParseXML(const char *xmcfg, const char *xml, int xendConfigVersion)
@@ -68,7 +69,8 @@ testCompareParseXML(const char *xmcfg, const char *xml, int xendConfigVersion)
     priv.caps = caps;
     conn->privateData = &priv;

-    if (!(def = virDomainDefParseString(caps, xmlData, 1 << VIR_DOMAIN_VIRT_XEN,
+    if (!(def = virDomainDefParseString(caps, xmlconf, xmlData,
+                                        1 << VIR_DOMAIN_VIRT_XEN,
                                         VIR_DOMAIN_XML_INACTIVE)))
         goto fail;

@@ -194,6 +196,9 @@ mymain(void)
     if (!(caps = testXenCapsInit()))
         return EXIT_FAILURE;

+    if (!(xmlconf = testXenXMLConfInit()))
+        return EXIT_FAILURE;
+
 #define DO_TEST(name, version)                                          \
     do {                                                                \
         struct testInfo info0 = { name, version, 0 };                   \
@@ -246,6 +251,7 @@ mymain(void)
     DO_TEST("pci-devs", 2);

     virObjectUnref(caps);
+    virObjectUnref(xmlconf);

     return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }
diff --git a/tests/xml2sexprtest.c b/tests/xml2sexprtest.c
index a41568a..364601a 100644
--- a/tests/xml2sexprtest.c
+++ b/tests/xml2sexprtest.c
@@ -15,6 +15,7 @@
 #include "testutilsxen.h"

 static virCapsPtr caps;
+static virDomainXMLConfPtr xmlconf;

 static int
 testCompareFiles(const char *xml, const char *sexpr, int xendConfigVersion)
@@ -31,7 +32,8 @@ testCompareFiles(const char *xml, const char *sexpr, int xendConfigVersion)
   if (virtTestLoadFile(sexpr, &sexprData) < 0)
       goto fail;

-  if (!(def = virDomainDefParseString(caps, xmlData, 1 << VIR_DOMAIN_VIRT_XEN,
+  if (!(def = virDomainDefParseString(caps, xmlconf, xmlData,
+                                      1 << VIR_DOMAIN_VIRT_XEN,
                                       VIR_DOMAIN_XML_INACTIVE)))
       goto fail;

@@ -102,6 +104,9 @@ mymain(void)
     if (!(caps = testXenCapsInit()))
         return EXIT_FAILURE;

+    if (!(xmlconf = testXenXMLConfInit()))
+        return EXIT_FAILURE;
+
     DO_TEST("pv", "pv", "pvtest", 1);
     DO_TEST("fv", "fv", "fvtest", 1);
     DO_TEST("pv", "pv", "pvtest", 2);
@@ -169,6 +174,7 @@ mymain(void)
     DO_TEST("escape", "escape", "fvtest", 1);

     virObjectUnref(caps);
+    virObjectUnref(xmlconf);

     return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }
diff --git a/tests/xml2vmxtest.c b/tests/xml2vmxtest.c
index c46c5a4..800fd2c 100644
--- a/tests/xml2vmxtest.c
+++ b/tests/xml2vmxtest.c
@@ -13,6 +13,7 @@

 static virCapsPtr caps;
 static virVMXContext ctx;
+static virDomainXMLConfPtr xmlconf;

 static int testDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED,
                                   virArch arch ATTRIBUTE_UNUSED)
@@ -72,6 +73,7 @@ testCapsInit(void)

   failure:
     virObjectUnref(caps);
+    virObjectUnref(xmlconf);
     caps = NULL;
 }

@@ -92,7 +94,8 @@ testCompareFiles(const char *xml, const char *vmx, int virtualHW_version)
         goto failure;
     }

-    def = virDomainDefParseString(caps, xmlData, 1 << VIR_DOMAIN_VIRT_VMWARE,
+    def = virDomainDefParseString(caps, xmlconf, xmlData,
+                                  1 << VIR_DOMAIN_VIRT_VMWARE,
                                   VIR_DOMAIN_XML_INACTIVE);

     if (def == NULL) {
@@ -237,6 +240,9 @@ mymain(void)
         return EXIT_FAILURE;
     }

+    if (!(xmlconf = virDomainXMLConfNew(NULL, NULL)))
+        return EXIT_FAILURE;
+
     ctx.opaque = NULL;
     ctx.parseFileName = NULL;
     ctx.formatFileName = testFormatVMXFileName;
-- 
1.8.1.5

--
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]