render / rpms / libvirt

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