[06/12] tests: qemuxml2argv: Rename testInfo* to testQemuInfo*

Message ID b3f999778fd826d2c8a801eee957d20daa490caa.1554137098.git.crobinso@redhat.com
State New
Headers show
Series
  • tests: qemuxml2xml: add DO_TEST_CAPS*
Related show

Commit Message

Cole Robinson April 1, 2019, 4:47 p.m.
In preparation for moving these bits to a shared place, rename them
to match one of the testqemuutils.c function prefixes. Rename
info->flags handling too as it will need to be moved

testInfoSetPaths isn't renamed because it will stay local

Signed-off-by: Cole Robinson <crobinso@redhat.com>

---
 tests/qemuxml2argvtest.c | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

-- 
2.21.0

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

Comments

Andrea Bolognani April 10, 2019, 4:19 p.m. | #1
On Mon, 2019-04-01 at 12:47 -0400, Cole Robinson wrote:
> In preparation for moving these bits to a shared place, rename them

> to match one of the testqemuutils.c function prefixes. Rename


s/testqemuutils/testutilsqemu/

[...]
>  static int

> -testCheckExclusiveFlags(int flags)

> +testQemuInfoCheckExclusiveFlags(int flags)


According to the logic used in the commit message to justify not
renaming testInfoSetPaths(), this one should either keep its name as
well or be moved to testutilsqemu. I would go for the former right
now, but it would be neat if you explored whether calling it from
xml2xml too would make sense, for a follow-up patch.

Everything else looks good, so assuming that you don't rename the
function

  Reviewed-by: Andrea Bolognani <abologna@redhat.com>


-- 
Andrea Bolognani / Red Hat / Virtualization

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

Patch

diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index a3fee41ea9..b87d2e3fb9 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -294,9 +294,9 @@  typedef enum {
     FLAG_FIPS               = 1 << 2,
     FLAG_REAL_CAPS          = 1 << 3,
     FLAG_SKIP_LEGACY_CPUS   = 1 << 4,
-} virQemuXML2ArgvTestFlags;
+} testQemuInfoFlags;
 
-struct testInfo {
+struct testQemuInfo {
     const char *name;
     char *infile;
     char *outfile;
@@ -380,7 +380,7 @@  testAddCPUModels(virQEMUCapsPtr caps, bool skipLegacy)
 
 
 static int
-testUpdateQEMUCaps(const struct testInfo *info,
+testUpdateQEMUCaps(const struct testQemuInfo *info,
                    virDomainObjPtr vm,
                    virCapsPtr caps)
 {
@@ -410,7 +410,7 @@  testUpdateQEMUCaps(const struct testInfo *info,
 
 
 static int
-testCheckExclusiveFlags(int flags)
+testQemuInfoCheckExclusiveFlags(int flags)
 {
     virCheckFlags(FLAG_EXPECT_FAILURE |
                   FLAG_EXPECT_PARSE_ERROR |
@@ -427,7 +427,7 @@  testCheckExclusiveFlags(int flags)
 static int
 testCompareXMLToArgv(const void *data)
 {
-    struct testInfo *info = (void *) data;
+    struct testQemuInfo *info = (void *) data;
     char *migrateURI = NULL;
     char *actualargv = NULL;
     unsigned int flags = info->flags;
@@ -460,7 +460,7 @@  testCompareXMLToArgv(const void *data)
     if (virQEMUCapsGet(info->qemuCaps, QEMU_CAPS_ENABLE_FIPS))
         flags |= FLAG_FIPS;
 
-    if (testCheckExclusiveFlags(info->flags) < 0)
+    if (testQemuInfoCheckExclusiveFlags(info->flags) < 0)
         goto cleanup;
 
     if (qemuTestCapsCacheInsert(driver.qemuCapsCache, info->qemuCaps) < 0)
@@ -605,14 +605,14 @@  typedef enum {
     ARG_CAPS_ARCH,
     ARG_CAPS_VER,
     ARG_END,
-} testInfoArgName;
+} testQemuInfoArgName;
 
 static int
-testInfoSetArgs(struct testInfo *info,
-                virHashTablePtr capslatest, ...)
+testQemuInfoSetArgs(struct testQemuInfo *info,
+                    virHashTablePtr capslatest, ...)
 {
     va_list argptr;
-    testInfoArgName argname;
+    testQemuInfoArgName argname;
     virQEMUCapsPtr qemuCaps = NULL;
     int gic = GIC_NONE;
     char *capsarch = NULL;
@@ -622,7 +622,7 @@  testInfoSetArgs(struct testInfo *info,
     int ret = -1;
 
     va_start(argptr, capslatest);
-    argname = va_arg(argptr, testInfoArgName);
+    argname = va_arg(argptr, testQemuInfoArgName);
     while (argname != ARG_END) {
         switch (argname) {
         case ARG_QEMU_CAPS:
@@ -684,7 +684,7 @@  testInfoSetArgs(struct testInfo *info,
             goto cleanup;
         }
 
-        argname = va_arg(argptr, testInfoArgName);
+        argname = va_arg(argptr, testQemuInfoArgName);
     }
 
     if (!!capsarch ^ !!capsver) {
@@ -740,7 +740,7 @@  testInfoSetArgs(struct testInfo *info,
 }
 
 static void
-testInfoClear(struct testInfo *info)
+testQemuInfoClear(struct testQemuInfo *info)
 {
     VIR_FREE(info->infile);
     VIR_FREE(info->outfile);
@@ -748,7 +748,7 @@  testInfoClear(struct testInfo *info)
 }
 
 static int
-testInfoSetPaths(struct testInfo *info, const char *suffix)
+testInfoSetPaths(struct testQemuInfo *info, const char *suffix)
 {
     if (virAsprintf(&info->infile, "%s/qemuxml2argvdata/%s.xml",
                     abs_srcdir, info->name) < 0 ||
@@ -881,18 +881,18 @@  mymain(void)
  */
 # define DO_TEST_INTERNAL(_name, _suffix, ...) \
     do { \
-        static struct testInfo info = { \
+        static struct testQemuInfo info = { \
             .name = _name, \
         }; \
-        if (testInfoSetArgs(&info, capslatest, \
-                            __VA_ARGS__, ARG_END) < 0) \
+        if (testQemuInfoSetArgs(&info, capslatest, \
+                                __VA_ARGS__, ARG_END) < 0) \
             return EXIT_FAILURE; \
         if (testInfoSetPaths(&info, _suffix)) \
             return EXIT_FAILURE; \
         if (virTestRun("QEMU XML-2-ARGV " _name _suffix, \
                        testCompareXMLToArgv, &info) < 0) \
             ret = -1; \
-        testInfoClear(&info); \
+        testQemuInfoClear(&info); \
     } while (0)
 
 # define DO_TEST_CAPS_INTERNAL(name, arch, ver, ...) \