[PATCH v3 2/7] tests: qemuxml2argv: Add infrastructure to pass output file suffix

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

 



To allow having more than one output file in the qemuxml2argvtest add a
suffix member to the testInfo struct which will allow testing the same
XML file with multiple capabilities files.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 tests/qemuxml2argvtest.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index aba946612f..6fe57c2a99 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -270,6 +270,7 @@ typedef enum {

 struct testInfo {
     const char *name;
+    const char *suffix;
     virQEMUCapsPtr qemuCaps;
     const char *migrateFrom;
     int migrateFd;
@@ -442,6 +443,7 @@ testCompareXMLToArgv(const void *data)
     char *args = NULL;
     char *migrateURI = NULL;
     char *actualargv = NULL;
+    const char *suffix = info->suffix;
     unsigned int flags = info->flags;
     unsigned int parseFlags = info->parseFlags;
     int ret = -1;
@@ -458,6 +460,9 @@ testCompareXMLToArgv(const void *data)
     if (!(conn = virGetConnect()))
         goto cleanup;

+    if (!suffix)
+        suffix = "";
+
     conn->secretDriver = &fakeSecretDriver;
     conn->storageDriver = &fakeStorageDriver;

@@ -472,8 +477,8 @@ testCompareXMLToArgv(const void *data)

     if (virAsprintf(&xml, "%s/qemuxml2argvdata/%s.xml",
                     abs_srcdir, info->name) < 0 ||
-        virAsprintf(&args, "%s/qemuxml2argvdata/%s.args",
-                    abs_srcdir, info->name) < 0)
+        virAsprintf(&args, "%s/qemuxml2argvdata/%s%s.args",
+                    abs_srcdir, info->name, suffix) < 0)
         goto cleanup;

     if (info->migrateFrom &&
@@ -657,7 +662,7 @@ mymain(void)
                       parseFlags, gic, ...) \
     do { \
         static struct testInfo info = { \
-            name, NULL, migrateFrom, migrateFd, (flags), parseFlags, \
+            name, NULL, NULL, migrateFrom, migrateFd, (flags), parseFlags, \
             false, NULL \
         }; \
         info.skipLegacyCPUs = skipLegacyCPUs; \
-- 
2.16.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