[libvirt] [PATCH v2 12/32] tests: qemuxml2argv: Remove the 'after startup XML' testing machinery

Peter Krempa pkrempa at redhat.com
Mon Feb 4 15:46:45 UTC 2019


A lot of code with no real impact and popularity. Remove all the helpers
now that the only test case is gone.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 tests/Makefile.am        |  1 -
 tests/qemuxml2argvtest.c | 54 +++-------------------------------------
 2 files changed, 3 insertions(+), 52 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index bdf7154fd5..ceb15d9218 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -129,7 +129,6 @@ EXTRA_DIST = \
 	qemumigparamsdata \
 	qemumonitorjsondata \
 	qemuxml2argvdata \
-	qemuxml2startupxmloutdata \
 	qemuxml2xmloutdata \
 	qemustatusxml2xmldata \
 	qemumemlockdata \
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index c3f4640044..046c28c4b8 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -291,9 +291,8 @@ typedef enum {
     FLAG_EXPECT_FAILURE     = 1 << 0,
     FLAG_EXPECT_PARSE_ERROR = 1 << 1,
     FLAG_FIPS               = 1 << 2,
-    FLAG_STEAL_VM           = 1 << 3,
-    FLAG_REAL_CAPS          = 1 << 4,
-    FLAG_SKIP_LEGACY_CPUS   = 1 << 5,
+    FLAG_REAL_CAPS          = 1 << 3,
+    FLAG_SKIP_LEGACY_CPUS   = 1 << 4,
 } virQemuXML2ArgvTestFlags;

 struct testInfo {
@@ -304,7 +303,6 @@ struct testInfo {
     int migrateFd;
     unsigned int flags;
     unsigned int parseFlags;
-    virDomainObjPtr vm;
 };


@@ -428,49 +426,16 @@ testUpdateQEMUCaps(const struct testInfo *info,
 }


-static int
-testCompareXMLToStartupXML(const void *data)
-{
-    const struct testInfo *info = data;
-    unsigned int format_flags = VIR_DOMAIN_DEF_FORMAT_SECURE;
-    char *xml = NULL;
-    char *actual = NULL;
-    int ret = -1;
-
-    if (!info->vm) {
-        VIR_TEST_DEBUG("VM object missing. Did the args conversion succeed?");
-        return -1;
-    }
-
-    if (virAsprintf(&xml, "%s/qemuxml2startupxmloutdata/%s.xml",
-                    abs_srcdir, info->name) < 0)
-        goto cleanup;
-
-    if (!(actual = virDomainDefFormat(info->vm->def, NULL, format_flags)))
-        goto cleanup;
-
-    ret = virTestCompareToFile(actual, xml);
-
- cleanup:
-    VIR_FREE(xml);
-    VIR_FREE(actual);
-    return ret;
-}
-
-
 static int
 testCheckExclusiveFlags(int flags)
 {
     virCheckFlags(FLAG_EXPECT_FAILURE |
                   FLAG_EXPECT_PARSE_ERROR |
                   FLAG_FIPS |
-                  FLAG_STEAL_VM |
                   FLAG_REAL_CAPS |
                   FLAG_SKIP_LEGACY_CPUS |
                   0, -1);

-    VIR_EXCLUSIVE_FLAGS_RET(FLAG_STEAL_VM, FLAG_EXPECT_FAILURE, -1);
-    VIR_EXCLUSIVE_FLAGS_RET(FLAG_STEAL_VM, FLAG_EXPECT_PARSE_ERROR, -1);
     VIR_EXCLUSIVE_FLAGS_RET(FLAG_REAL_CAPS, FLAG_SKIP_LEGACY_CPUS, -1);
     return 0;
 }
@@ -643,9 +608,6 @@ testCompareXMLToArgv(const void *data)
         ret = 0;
     }

-    if (flags & FLAG_STEAL_VM)
-        VIR_STEAL_PTR(info->vm, vm);
-
  cleanup:
     VIR_FREE(log);
     VIR_FREE(actualargv);
@@ -781,7 +743,7 @@ mymain(void)
     do { \
         static struct testInfo info = { \
             name, "." suffix, NULL, migrateFrom, migrateFrom ? 7 : -1,\
-            (flags | FLAG_REAL_CAPS), parseFlags, NULL \
+            (flags | FLAG_REAL_CAPS), parseFlags, \
         }; \
         if (!(info.qemuCaps = qemuTestParseCapabilitiesArch(virArchFromString(arch), \
                                                             capsfile))) \
@@ -792,7 +754,6 @@ mymain(void)
                        testCompareXMLToArgv, &info) < 0) \
             ret = -1; \
         virObjectUnref(info.qemuCaps); \
-        virObjectUnref(info.vm); \
     } while (0)

 # define TEST_CAPS_PATH abs_srcdir "/qemucapabilitiesdata/caps_"
@@ -838,7 +799,6 @@ mymain(void)
     do { \
         static struct testInfo info = { \
             name, NULL, NULL, migrateFrom, migrateFd, (flags), parseFlags, \
-            NULL \
         }; \
         if (testInitQEMUCaps(&info, gic) < 0) \
             return EXIT_FAILURE; \
@@ -846,12 +806,7 @@ mymain(void)
         if (virTestRun("QEMU XML-2-ARGV " name, \
                        testCompareXMLToArgv, &info) < 0) \
             ret = -1; \
-        if (((flags) & FLAG_STEAL_VM) && \
-            virTestRun("QEMU XML-2-startup-XML " name, \
-                       testCompareXMLToStartupXML, &info) < 0) \
-            ret = -1; \
         virObjectUnref(info.qemuCaps); \
-        virObjectUnref(info.vm); \
     } while (0)

 # define DO_TEST(name, ...) \
@@ -860,9 +815,6 @@ mymain(void)
 # define DO_TEST_GIC(name, gic, ...) \
     DO_TEST_FULL(name, NULL, -1, 0, 0, gic, __VA_ARGS__)

-# define DO_TEST_WITH_STARTUP(name, ...) \
-    DO_TEST_FULL(name, NULL, -1, FLAG_STEAL_VM, 0, GIC_NONE, __VA_ARGS__)
-
 # define DO_TEST_FAILURE(name, ...) \
     DO_TEST_FULL(name, NULL, -1, FLAG_EXPECT_FAILURE, \
                  0, GIC_NONE, __VA_ARGS__)
-- 
2.20.1




More information about the libvir-list mailing list