Blob Blame History Raw
From 747e726988e43451139b3113e7b5f60b2f50e17e Mon Sep 17 00:00:00 2001
Message-Id: <747e726988e43451139b3113e7b5f60b2f50e17e@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 23 Jun 2020 12:23:58 +0200
Subject: [PATCH] qemublocktest: Add 'basic' tests for backup bitmap handling
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The 'basic' case is just a single backing store layer containing the
bitmaps so we just copy the bitmaps over to the backup bitmap.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
(cherry picked from commit 8c6e2da25e55081164cb5eb02ddece38500c5cff)
https://bugzilla.redhat.com/show_bug.cgi?id=1804593
Message-Id: <94d168ffd27a6da8ffec1dfb37268e79c395c21e.1592906423.git.pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
 tests/qemublocktest.c                         |  4 +++
 .../backupmerge/basic-deep-out.json           | 25 +++++++++++++++++++
 .../backupmerge/basic-flat-out.json           | 25 +++++++++++++++++++
 .../backupmerge/basic-intermediate-out.json   | 25 +++++++++++++++++++
 4 files changed, 79 insertions(+)
 create mode 100644 tests/qemublocktestdata/backupmerge/basic-deep-out.json
 create mode 100644 tests/qemublocktestdata/backupmerge/basic-flat-out.json
 create mode 100644 tests/qemublocktestdata/backupmerge/basic-intermediate-out.json

diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
index dcdc9eade0..7a0159f659 100644
--- a/tests/qemublocktest.c
+++ b/tests/qemublocktest.c
@@ -1262,6 +1262,10 @@ mymain(void)
 
     TEST_BACKUP_BITMAP_CALCULATE("empty", bitmapSourceChain, "a", "empty");
 
+    TEST_BACKUP_BITMAP_CALCULATE("basic-flat", bitmapSourceChain, "current", "basic");
+    TEST_BACKUP_BITMAP_CALCULATE("basic-intermediate", bitmapSourceChain, "d", "basic");
+    TEST_BACKUP_BITMAP_CALCULATE("basic-deep", bitmapSourceChain, "a", "basic");
+
 #define TEST_CHECKPOINT_DELETE(testname, delbmp, named) \
     do { \
         checkpointdeletedata.name = testname; \
diff --git a/tests/qemublocktestdata/backupmerge/basic-deep-out.json b/tests/qemublocktestdata/backupmerge/basic-deep-out.json
new file mode 100644
index 0000000000..ff77af789b
--- /dev/null
+++ b/tests/qemublocktestdata/backupmerge/basic-deep-out.json
@@ -0,0 +1,25 @@
+[
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "target_node",
+      "name": "target-bitmap-name",
+      "persistent": false,
+      "disabled": true,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "target_node",
+      "target": "target-bitmap-name",
+      "bitmaps": [
+        {
+          "node": "libvirt-1-format",
+          "name": "a"
+        }
+      ]
+    }
+  }
+]
diff --git a/tests/qemublocktestdata/backupmerge/basic-flat-out.json b/tests/qemublocktestdata/backupmerge/basic-flat-out.json
new file mode 100644
index 0000000000..4637bbc377
--- /dev/null
+++ b/tests/qemublocktestdata/backupmerge/basic-flat-out.json
@@ -0,0 +1,25 @@
+[
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "target_node",
+      "name": "target-bitmap-name",
+      "persistent": false,
+      "disabled": true,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "target_node",
+      "target": "target-bitmap-name",
+      "bitmaps": [
+        {
+          "node": "libvirt-1-format",
+          "name": "current"
+        }
+      ]
+    }
+  }
+]
diff --git a/tests/qemublocktestdata/backupmerge/basic-intermediate-out.json b/tests/qemublocktestdata/backupmerge/basic-intermediate-out.json
new file mode 100644
index 0000000000..f2f3b3f568
--- /dev/null
+++ b/tests/qemublocktestdata/backupmerge/basic-intermediate-out.json
@@ -0,0 +1,25 @@
+[
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "target_node",
+      "name": "target-bitmap-name",
+      "persistent": false,
+      "disabled": true,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "target_node",
+      "target": "target-bitmap-name",
+      "bitmaps": [
+        {
+          "node": "libvirt-1-format",
+          "name": "d"
+        }
+      ]
+    }
+  }
+]
-- 
2.27.0