[PATCH 07/41] qemuxml2argvtest: Reorder functions

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

 



testCompareXMLToArgv will soon need to call a few function which are
defined further in the code. Let's move them up a bit.

Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 tests/qemuxml2argvtest.c | 104 ++++++++++++++++++++++++-----------------------
 1 file changed, 53 insertions(+), 51 deletions(-)

diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 4ec0990..82926db 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -274,6 +274,59 @@ struct testInfo {
     unsigned int parseFlags;
 };
 
+
+static int
+testAddCPUModels(virQEMUCapsPtr caps, bool skipLegacy)
+{
+    const char *newModels[] = {
+        "Opteron_G3", "Opteron_G2", "Opteron_G1",
+        "Nehalem", "Penryn", "Conroe",
+        "Haswell-noTSX", "Haswell",
+    };
+    const char *legacyModels[] = {
+        "n270", "athlon", "pentium3", "pentium2", "pentium",
+        "486", "coreduo", "kvm32", "qemu32", "kvm64",
+        "core2duo", "phenom", "qemu64",
+    };
+
+    if (virQEMUCapsAddCPUDefinitions(caps, newModels,
+                                     ARRAY_CARDINALITY(newModels)) < 0)
+        return -1;
+
+    if (skipLegacy)
+        return 0;
+
+    if (virQEMUCapsAddCPUDefinitions(caps, legacyModels,
+                                     ARRAY_CARDINALITY(legacyModels)) < 0)
+        return -1;
+
+    return 0;
+}
+
+
+static int
+testPrepareExtraFlags(struct testInfo *info,
+                      bool skipLegacyCPUs,
+                      int gic)
+{
+    int ret = -1;
+
+    if (!(info->qemuCaps = virQEMUCapsNew()))
+        goto cleanup;
+
+    if (testAddCPUModels(info->qemuCaps, skipLegacyCPUs) < 0)
+        goto cleanup;
+
+    if (testQemuCapsSetGIC(info->qemuCaps, gic) < 0)
+        goto cleanup;
+
+    ret = 0;
+
+ cleanup:
+    return ret;
+}
+
+
 static int
 testCompareXMLToArgv(const void *data)
 {
@@ -425,57 +478,6 @@ testCompareXMLToArgv(const void *data)
 
 
 static int
-testAddCPUModels(virQEMUCapsPtr caps, bool skipLegacy)
-{
-    const char *newModels[] = {
-        "Opteron_G3", "Opteron_G2", "Opteron_G1",
-        "Nehalem", "Penryn", "Conroe",
-        "Haswell-noTSX", "Haswell",
-    };
-    const char *legacyModels[] = {
-        "n270", "athlon", "pentium3", "pentium2", "pentium",
-        "486", "coreduo", "kvm32", "qemu32", "kvm64",
-        "core2duo", "phenom", "qemu64",
-    };
-
-    if (virQEMUCapsAddCPUDefinitions(caps, newModels,
-                                     ARRAY_CARDINALITY(newModels)) < 0)
-        return -1;
-
-    if (skipLegacy)
-        return 0;
-
-    if (virQEMUCapsAddCPUDefinitions(caps, legacyModels,
-                                     ARRAY_CARDINALITY(legacyModels)) < 0)
-        return -1;
-
-    return 0;
-}
-
-
-static int
-testPrepareExtraFlags(struct testInfo *info,
-                      bool skipLegacyCPUs,
-                      int gic)
-{
-    int ret = -1;
-
-    if (!(info->qemuCaps = virQEMUCapsNew()))
-        goto cleanup;
-
-    if (testAddCPUModels(info->qemuCaps, skipLegacyCPUs) < 0)
-        goto cleanup;
-
-    if (testQemuCapsSetGIC(info->qemuCaps, gic) < 0)
-        goto cleanup;
-
-    ret = 0;
-
- cleanup:
-    return ret;
-}
-
-static int
 mymain(void)
 {
     int ret = 0;
-- 
2.9.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]