Blame SOURCES/libvirt-testQemuDiskXMLToPropsValidateFileSrcOnly-Move-together-with-rest-of-xml-json-code.patch

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