]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
testQemuDiskXMLToPropsValidateFileSrcOnly: Move together with rest of xml->json code
authorPeter Krempa <pkrempa@redhat.com>
Mon, 23 Mar 2020 10:50:57 +0000 (11:50 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 24 Mar 2020 13:17:47 +0000 (14:17 +0100)
The function was misplaced. Group it together with other helper
functions for testing disk XML to qemu JSON props conversion.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
tests/qemublocktest.c

index dfcf7552c1b9bdf644214f9ec2df5b2fa603e2f5..312af0d9622b3496822d7c5fdd823e5a287d1943 100644 (file)
@@ -387,6 +387,37 @@ testQemuDiskXMLToPropsValidateFile(const void *opaque)
 }
 
 
+static int
+testQemuDiskXMLToPropsValidateFileSrcOnly(const void *opaque)
+{
+    struct testQemuDiskXMLToJSONData *data = (void *) opaque;
+    g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+    g_autofree char *jsonpath = NULL;
+    g_autofree char *actual = NULL;
+    size_t i;
+
+    if (data->fail)
+        return EXIT_AM_SKIP;
+
+    jsonpath = g_strdup_printf("%s%s-srconly.json", testQemuDiskXMLToJSONPath,
+                               data->name);
+
+    for (i = 0; i < data->npropssrc; i++) {
+        g_autofree char *jsonstr = NULL;
+
+        if (!(jsonstr = virJSONValueToString(data->propssrc[i], true)))
+            return -1;
+
+        virBufferAdd(&buf, jsonstr, -1);
+    }
+
+    actual = virBufferContentAndReset(&buf);
+
+    return virTestCompareToFile(actual, jsonpath);
+}
+
+
+
 struct testQemuImageCreateData {
     const char *name;
     const char *backingname;
@@ -515,36 +546,6 @@ testQemuImageCreate(const void *opaque)
 }
 
 
-static int
-testQemuDiskXMLToPropsValidateFileSrcOnly(const void *opaque)
-{
-    struct testQemuDiskXMLToJSONData *data = (void *) opaque;
-    g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
-    g_autofree char *jsonpath = NULL;
-    g_autofree char *actual = NULL;
-    size_t i;
-
-    if (data->fail)
-        return EXIT_AM_SKIP;
-
-    jsonpath = g_strdup_printf("%s%s-srconly.json", testQemuDiskXMLToJSONPath,
-                               data->name);
-
-    for (i = 0; i < data->npropssrc; i++) {
-        g_autofree char *jsonstr = NULL;
-
-        if (!(jsonstr = virJSONValueToString(data->propssrc[i], true)))
-            return -1;
-
-        virBufferAdd(&buf, jsonstr, -1);
-    }
-
-    actual = virBufferContentAndReset(&buf);
-
-    return virTestCompareToFile(actual, jsonpath);
-}
-
-
 static const char *bitmapDetectPrefix = "qemublocktestdata/bitmap/";
 
 static void