render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
b971b8
From 60c3e3fd52b1d2fe5fbab42d762248a02b5143f6 Mon Sep 17 00:00:00 2001
b971b8
Message-Id: <60c3e3fd52b1d2fe5fbab42d762248a02b5143f6@dist-git>
b971b8
From: Peter Krempa <pkrempa@redhat.com>
b971b8
Date: Tue, 23 Jun 2020 12:23:40 +0200
b971b8
Subject: [PATCH] qemublocktest: Add 'empty' case for incremental backup test
b971b8
MIME-Version: 1.0
b971b8
Content-Type: text/plain; charset=UTF-8
b971b8
Content-Transfer-Encoding: 8bit
b971b8
b971b8
Use the new test data when calculating incremental backup operations. As
b971b8
incremental backup fails with no bitmap the test code is modified to
b971b8
allow testing this case too.
b971b8
b971b8
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
b971b8
Reviewed-by: Eric Blake <eblake@redhat.com>
b971b8
(cherry picked from commit 218d00f443a5e211ea3664996c610f62b18425f7)
b971b8
https://bugzilla.redhat.com/show_bug.cgi?id=1804593
b971b8
Message-Id: <45ec7a3b4dce5f583d2864991e16cdc090b8dfce.1592906423.git.pkrempa@redhat.com>
b971b8
Reviewed-by: Ján Tomko <jtomko@redhat.com>
b971b8
---
b971b8
 tests/qemublocktest.c                         | 19 ++++++++++---------
b971b8
 .../backupmerge/empty-out.json                |  1 +
b971b8
 2 files changed, 11 insertions(+), 9 deletions(-)
b971b8
 create mode 100644 tests/qemublocktestdata/backupmerge/empty-out.json
b971b8
b971b8
diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
b971b8
index 2063ca0be7..3ef6ccec9b 100644
b971b8
--- a/tests/qemublocktest.c
b971b8
+++ b/tests/qemublocktest.c
b971b8
@@ -793,17 +793,16 @@ testQemuBackupIncrementalBitmapCalculate(const void *opaque)
b971b8
 
b971b8
     incremental = testQemuBackupGetIncremental(data->incremental);
b971b8
 
b971b8
-    if (!(mergebitmaps = qemuBackupDiskPrepareOneBitmapsChain(incremental,
b971b8
-                                                              data->chain,
b971b8
-                                                              nodedata,
b971b8
-                                                              "testdisk"))) {
b971b8
-        VIR_TEST_VERBOSE("failed to calculate merged bitmaps");
b971b8
-        return -1;
b971b8
+    if ((mergebitmaps = qemuBackupDiskPrepareOneBitmapsChain(incremental,
b971b8
+                                                             data->chain,
b971b8
+                                                             nodedata,
b971b8
+                                                             "testdisk"))) {
b971b8
+        if (!(actual = virJSONValueToString(mergebitmaps, true)))
b971b8
+            return -1;
b971b8
+    } else {
b971b8
+        actual = g_strdup("NULL\n");
b971b8
     }
b971b8
 
b971b8
-    if (!(actual = virJSONValueToString(mergebitmaps, true)))
b971b8
-        return -1;
b971b8
-
b971b8
     return virTestCompareToFile(actual, expectpath);
b971b8
 }
b971b8
 
b971b8
@@ -1311,6 +1310,8 @@ mymain(void)
b971b8
             ret = -1; \
b971b8
     } while (0)
b971b8
 
b971b8
+    TEST_BACKUP_BITMAP_CALCULATE("empty", bitmapSourceChain, "a", "empty");
b971b8
+
b971b8
     TEST_BACKUP_BITMAP_CALCULATE("basic-flat", bitmapSourceChain, "current", "basic");
b971b8
     TEST_BACKUP_BITMAP_CALCULATE("basic-intermediate", bitmapSourceChain, "d", "basic");
b971b8
     TEST_BACKUP_BITMAP_CALCULATE("basic-deep", bitmapSourceChain, "a", "basic");
b971b8
diff --git a/tests/qemublocktestdata/backupmerge/empty-out.json b/tests/qemublocktestdata/backupmerge/empty-out.json
b971b8
new file mode 100644
b971b8
index 0000000000..7951defec1
b971b8
--- /dev/null
b971b8
+++ b/tests/qemublocktestdata/backupmerge/empty-out.json
b971b8
@@ -0,0 +1 @@
b971b8
+NULL
b971b8
-- 
b971b8
2.27.0
b971b8