]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuxml2argvtest: Reorder functions
authorJiri Denemark <jdenemar@redhat.com>
Wed, 3 Aug 2016 08:47:00 +0000 (10:47 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Thu, 22 Sep 2016 13:40:08 +0000 (15:40 +0200)
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@redhat.com>
tests/qemuxml2argvtest.c

index bd140fc3b2046f0aabd22c115cec7b01e03d996d..6c7bc4b1eb53988f3c456710954aba2cb7892dd8 100644 (file)
@@ -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)
 {
@@ -424,57 +477,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)
 {