|
|
b971b8 |
From 25790c1e38a02e16182bb8c708af656f82db950a Mon Sep 17 00:00:00 2001
|
|
|
b971b8 |
Message-Id: <25790c1e38a02e16182bb8c708af656f82db950a@dist-git>
|
|
|
b971b8 |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
b971b8 |
Date: Tue, 23 Jun 2020 12:23:46 +0200
|
|
|
b971b8 |
Subject: [PATCH] qemublocktest: Extract printing of nodename list
|
|
|
b971b8 |
MIME-Version: 1.0
|
|
|
b971b8 |
Content-Type: text/plain; charset=UTF-8
|
|
|
b971b8 |
Content-Transfer-Encoding: 8bit
|
|
|
b971b8 |
|
|
|
b971b8 |
There will be multiple places where we'll need to print nodenames from a
|
|
|
b971b8 |
GSList of virStorageSource for testing purposes. Extract the code into a
|
|
|
b971b8 |
function.
|
|
|
b971b8 |
|
|
|
b971b8 |
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
|
|
b971b8 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
b971b8 |
(cherry picked from commit 69cacbe5061a82d3207df113d5c845f38f3decca)
|
|
|
b971b8 |
https://bugzilla.redhat.com/show_bug.cgi?id=1804593
|
|
|
b971b8 |
Message-Id: <6f3b4a3424a76d6fe788545b0ddffd3cbb372623.1592906423.git.pkrempa@redhat.com>
|
|
|
b971b8 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
b971b8 |
---
|
|
|
b971b8 |
tests/qemublocktest.c | 27 ++++++++++++++++++---------
|
|
|
b971b8 |
1 file changed, 18 insertions(+), 9 deletions(-)
|
|
|
b971b8 |
|
|
|
b971b8 |
diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
|
|
|
b971b8 |
index 75527ca64b..9d6d871be8 100644
|
|
|
b971b8 |
--- a/tests/qemublocktest.c
|
|
|
b971b8 |
+++ b/tests/qemublocktest.c
|
|
|
b971b8 |
@@ -647,6 +647,23 @@ testQemuDetectBitmaps(const void *opaque)
|
|
|
b971b8 |
}
|
|
|
b971b8 |
|
|
|
b971b8 |
|
|
|
b971b8 |
+static void
|
|
|
b971b8 |
+testQemuBitmapListPrint(const char *title,
|
|
|
b971b8 |
+ GSList *next,
|
|
|
b971b8 |
+ virBufferPtr buf)
|
|
|
b971b8 |
+{
|
|
|
b971b8 |
+ if (!next)
|
|
|
b971b8 |
+ return;
|
|
|
b971b8 |
+
|
|
|
b971b8 |
+ virBufferAsprintf(buf, "%s\n", title);
|
|
|
b971b8 |
+
|
|
|
b971b8 |
+ for (; next; next = next->next) {
|
|
|
b971b8 |
+ virStorageSourcePtr src = next->data;
|
|
|
b971b8 |
+ virBufferAsprintf(buf, "%s\n", src->nodeformat);
|
|
|
b971b8 |
+ }
|
|
|
b971b8 |
+}
|
|
|
b971b8 |
+
|
|
|
b971b8 |
+
|
|
|
b971b8 |
static virStorageSourcePtr
|
|
|
b971b8 |
testQemuBackupIncrementalBitmapCalculateGetFakeImage(size_t idx)
|
|
|
b971b8 |
{
|
|
|
b971b8 |
@@ -829,7 +846,6 @@ testQemuCheckpointDeleteMerge(const void *opaque)
|
|
|
b971b8 |
g_autoptr(virHashTable) nodedata = NULL;
|
|
|
b971b8 |
g_autoptr(GSList) reopenimages = NULL;
|
|
|
b971b8 |
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
|
|
b971b8 |
- GSList *tmp;
|
|
|
b971b8 |
|
|
|
b971b8 |
expectpath = g_strdup_printf("%s/%s%s-out.json", abs_srcdir,
|
|
|
b971b8 |
checkpointDeletePrefix, data->name);
|
|
|
b971b8 |
@@ -858,14 +874,7 @@ testQemuCheckpointDeleteMerge(const void *opaque)
|
|
|
b971b8 |
virBufferAddLit(&buf, "NULL\n");
|
|
|
b971b8 |
}
|
|
|
b971b8 |
|
|
|
b971b8 |
- if (reopenimages) {
|
|
|
b971b8 |
- virBufferAddLit(&buf, "reopen nodes:\n");
|
|
|
b971b8 |
-
|
|
|
b971b8 |
- for (tmp = reopenimages; tmp; tmp = tmp->next) {
|
|
|
b971b8 |
- virStorageSourcePtr src = tmp->data;
|
|
|
b971b8 |
- virBufferAsprintf(&buf, "%s\n", src->nodeformat);
|
|
|
b971b8 |
- }
|
|
|
b971b8 |
- }
|
|
|
b971b8 |
+ testQemuBitmapListPrint("reopen nodes:", reopenimages, &buf;;
|
|
|
b971b8 |
|
|
|
b971b8 |
actual = virBufferContentAndReset(&buf;;
|
|
|
b971b8 |
|
|
|
b971b8 |
--
|
|
|
b971b8 |
2.27.0
|
|
|
b971b8 |
|