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