render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
d76c62
From 067d165d1ffd968d07ff54c07ccd3bb529d0c130 Mon Sep 17 00:00:00 2001
d76c62
Message-Id: <067d165d1ffd968d07ff54c07ccd3bb529d0c130@dist-git>
d76c62
From: Peter Krempa <pkrempa@redhat.com>
d76c62
Date: Tue, 24 Mar 2020 16:25:59 +0100
d76c62
Subject: [PATCH] testQemuDiskXMLToPropsValidateFileSrcOnly: Move together with
d76c62
 rest of xml->json code
d76c62
MIME-Version: 1.0
d76c62
Content-Type: text/plain; charset=UTF-8
d76c62
Content-Transfer-Encoding: 8bit
d76c62
d76c62
The function was misplaced. Group it together with other helper
d76c62
functions for testing disk XML to qemu JSON props conversion.
d76c62
d76c62
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
d76c62
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
d76c62
(cherry picked from commit fed97cb435092d9de6f3c862ef297e722f0c0263)
d76c62
d76c62
https://bugzilla.redhat.com/show_bug.cgi?id=1804617
d76c62
Message-Id: <8e84dfd63f90b8b0bf10fe72bb3dcf07af9f6e96.1585063415.git.pkrempa@redhat.com>
d76c62
Reviewed-by: Ján Tomko <jtomko@redhat.com>
d76c62
---
d76c62
 tests/qemublocktest.c | 61 ++++++++++++++++++++++---------------------
d76c62
 1 file changed, 31 insertions(+), 30 deletions(-)
d76c62
d76c62
diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
d76c62
index 40aa1e2825..14c80960b1 100644
d76c62
--- a/tests/qemublocktest.c
d76c62
+++ b/tests/qemublocktest.c
d76c62
@@ -387,6 +387,37 @@ testQemuDiskXMLToPropsValidateFile(const void *opaque)
d76c62
 }
d76c62
 
d76c62
 
d76c62
+static int
d76c62
+testQemuDiskXMLToPropsValidateFileSrcOnly(const void *opaque)
d76c62
+{
d76c62
+    struct testQemuDiskXMLToJSONData *data = (void *) opaque;
d76c62
+    g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
d76c62
+    g_autofree char *jsonpath = NULL;
d76c62
+    g_autofree char *actual = NULL;
d76c62
+    size_t i;
d76c62
+
d76c62
+    if (data->fail)
d76c62
+        return EXIT_AM_SKIP;
d76c62
+
d76c62
+    jsonpath = g_strdup_printf("%s%s-srconly.json", testQemuDiskXMLToJSONPath,
d76c62
+                               data->name);
d76c62
+
d76c62
+    for (i = 0; i < data->npropssrc; i++) {
d76c62
+        g_autofree char *jsonstr = NULL;
d76c62
+
d76c62
+        if (!(jsonstr = virJSONValueToString(data->propssrc[i], true)))
d76c62
+            return -1;
d76c62
+
d76c62
+        virBufferAdd(&buf, jsonstr, -1);
d76c62
+    }
d76c62
+
d76c62
+    actual = virBufferContentAndReset(&buf;;
d76c62
+
d76c62
+    return virTestCompareToFile(actual, jsonpath);
d76c62
+}
d76c62
+
d76c62
+
d76c62
+
d76c62
 struct testQemuImageCreateData {
d76c62
     const char *name;
d76c62
     const char *backingname;
d76c62
@@ -515,36 +546,6 @@ testQemuImageCreate(const void *opaque)
d76c62
 }
d76c62
 
d76c62
 
d76c62
-static int
d76c62
-testQemuDiskXMLToPropsValidateFileSrcOnly(const void *opaque)
d76c62
-{
d76c62
-    struct testQemuDiskXMLToJSONData *data = (void *) opaque;
d76c62
-    g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
d76c62
-    g_autofree char *jsonpath = NULL;
d76c62
-    g_autofree char *actual = NULL;
d76c62
-    size_t i;
d76c62
-
d76c62
-    if (data->fail)
d76c62
-        return EXIT_AM_SKIP;
d76c62
-
d76c62
-    jsonpath = g_strdup_printf("%s%s-srconly.json", testQemuDiskXMLToJSONPath,
d76c62
-                               data->name);
d76c62
-
d76c62
-    for (i = 0; i < data->npropssrc; i++) {
d76c62
-        g_autofree char *jsonstr = NULL;
d76c62
-
d76c62
-        if (!(jsonstr = virJSONValueToString(data->propssrc[i], true)))
d76c62
-            return -1;
d76c62
-
d76c62
-        virBufferAdd(&buf, jsonstr, -1);
d76c62
-    }
d76c62
-
d76c62
-    actual = virBufferContentAndReset(&buf;;
d76c62
-
d76c62
-    return virTestCompareToFile(actual, jsonpath);
d76c62
-}
d76c62
-
d76c62
-
d76c62
 static const char *bitmapDetectPrefix = "qemublocktestdata/bitmap/";
d76c62
 
d76c62
 static void
d76c62
-- 
d76c62
2.26.0
d76c62