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