[PATCH 19/24] testutilsqemu: Add support for specifying the variant for qemuxml2(argv|xml)test

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

 



Add the possibility to control the variant of the test data for real
caps testing in qemuxml2argvtest and qemuxml2xmltest.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 tests/testutilsqemu.c | 15 ++++++++++++---
 tests/testutilsqemu.h |  2 ++
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index 7f2aca5221..e12eaf4dd8 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -943,6 +943,10 @@ testQemuInfoSetArgs(struct testQemuInfo *info,
             info->args.capsver = va_arg(argptr, char *);
             break;

+        case ARG_CAPS_VARIANT:
+            info->args.capsvariant = va_arg(argptr, char *);
+            break;
+
         case ARG_CAPS_HOST_CPU_MODEL:
             info->args.capsHostCPUModel = va_arg(argptr, int);
             break;
@@ -1008,6 +1012,9 @@ testQemuInfoInitArgs(struct testQemuInfo *info)

     info->args.newargs = false;

+    if (!info->args.capsvariant)
+        info->args.capsvariant = "";
+
     if (info->args.invalidarg) {
         fprintf(stderr, "Invalid argument encountered by 'testQemuInfoSetArgs'\n");
         return -1;
@@ -1025,7 +1032,8 @@ testQemuInfoInitArgs(struct testQemuInfo *info)
         info->arch = virArchFromString(info->args.capsarch);

         if (STREQ(info->args.capsver, "latest")) {
-            struct testQemuCapsFile *f = g_hash_table_lookup(info->conf->capslatest, info->args.capsarch);
+            g_autofree char *archvariant = g_strdup_printf("%s%s", info->args.capsarch, info->args.capsvariant);
+            struct testQemuCapsFile *f = g_hash_table_lookup(info->conf->capslatest, archvariant);

             if (!f) {
                 fprintf(stderr, "'latest' caps for '%s' were not found\n", info->args.capsarch);
@@ -1035,10 +1043,11 @@ testQemuInfoInitArgs(struct testQemuInfo *info)
             capsfile = g_strdup(f->path);
             stripmachinealiases = true;
         } else {
-            capsfile = g_strdup_printf("%s/caps_%s_%s.xml",
+            capsfile = g_strdup_printf("%s/caps_%s_%s%s.xml",
                                        TEST_QEMU_CAPS_PATH,
                                        info->args.capsver,
-                                       info->args.capsarch);
+                                       info->args.capsarch,
+                                       info->args.capsvariant);
         }

         if (!g_hash_table_lookup_extended(info->conf->capscache, capsfile, NULL, (void **) &cachedcaps)) {
diff --git a/tests/testutilsqemu.h b/tests/testutilsqemu.h
index d75dfee839..070bca6a53 100644
--- a/tests/testutilsqemu.h
+++ b/tests/testutilsqemu.h
@@ -51,6 +51,7 @@ typedef enum {
     ARG_PARSEFLAGS,
     ARG_CAPS_ARCH,
     ARG_CAPS_VER,
+    ARG_CAPS_VARIANT,
     ARG_CAPS_HOST_CPU_MODEL,
     ARG_HOST_OS,
     ARG_FD_GROUP, /* name, nfds, fd[0], ... fd[n-1] */
@@ -86,6 +87,7 @@ struct testQemuArgs {
     virBitmap *fakeCapsDel;
     char *capsver;
     char *capsarch;
+    const char *capsvariant;
     qemuTestCPUDef capsHostCPUModel;
     int gic;
     testQemuHostOS hostOS;
-- 
2.39.2




[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