fbe740
From 07e5713853789cc0b216c7d3731cbda68f905eac Mon Sep 17 00:00:00 2001
fbe740
Message-Id: <07e5713853789cc0b216c7d3731cbda68f905eac@dist-git>
fbe740
From: Peter Krempa <pkrempa@redhat.com>
fbe740
Date: Tue, 23 Jun 2020 12:23:39 +0200
fbe740
Subject: [PATCH] qemublocktest: Add 'empty' test case for bitmaps
fbe740
MIME-Version: 1.0
fbe740
Content-Type: text/plain; charset=UTF-8
fbe740
Content-Transfer-Encoding: 8bit
fbe740
fbe740
Add test data for an image without bitmaps.
fbe740
fbe740
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
fbe740
Reviewed-by: Eric Blake <eblake@redhat.com>
fbe740
(cherry picked from commit 15ef0c1c3891feaa949e082d922c54ebe6563e40)
fbe740
https://bugzilla.redhat.com/show_bug.cgi?id=1804593
fbe740
Message-Id: <2e329c1ef636060b4c094cac8c0d3558994986ce.1592906423.git.pkrempa@redhat.com>
fbe740
Reviewed-by: Ján Tomko <jtomko@redhat.com>
fbe740
---
fbe740
 tests/qemublocktest.c                     |  4 ++
fbe740
 tests/qemublocktestdata/bitmap/empty.json | 70 +++++++++++++++++++++++
fbe740
 tests/qemublocktestdata/bitmap/empty.out  |  1 +
fbe740
 3 files changed, 75 insertions(+)
fbe740
 create mode 100644 tests/qemublocktestdata/bitmap/empty.json
fbe740
 create mode 100644 tests/qemublocktestdata/bitmap/empty.out
fbe740
fbe740
diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
fbe740
index d15965d9eb..2063ca0be7 100644
fbe740
--- a/tests/qemublocktest.c
fbe740
+++ b/tests/qemublocktest.c
fbe740
@@ -1291,6 +1291,8 @@ mymain(void)
fbe740
             ret = -1; \
fbe740
     } while (0)
fbe740
 
fbe740
+    TEST_BITMAP_DETECT("empty");
fbe740
+
fbe740
     TEST_BITMAP_DETECT("basic");
fbe740
     TEST_BITMAP_DETECT("synthetic");
fbe740
     TEST_BITMAP_DETECT("snapshots");
fbe740
@@ -1359,6 +1361,8 @@ mymain(void)
fbe740
             ret = -1; \
fbe740
     } while (0)
fbe740
 
fbe740
+    TEST_BITMAP_VALIDATE("empty", "a", false);
fbe740
+
fbe740
     TEST_BITMAP_VALIDATE("basic", "a", true);
fbe740
     TEST_BITMAP_VALIDATE("basic", "b", true);
fbe740
     TEST_BITMAP_VALIDATE("basic", "c", true);
fbe740
diff --git a/tests/qemublocktestdata/bitmap/empty.json b/tests/qemublocktestdata/bitmap/empty.json
fbe740
new file mode 100644
fbe740
index 0000000000..ec43b25f0d
fbe740
--- /dev/null
fbe740
+++ b/tests/qemublocktestdata/bitmap/empty.json
fbe740
@@ -0,0 +1,70 @@
fbe740
+[
fbe740
+    {
fbe740
+        "iops_rd": 0,
fbe740
+        "detect_zeroes": "off",
fbe740
+        "image": {
fbe740
+            "virtual-size": 10485760,
fbe740
+            "filename": "/tmp/pull4.qcow2",
fbe740
+            "cluster-size": 65536,
fbe740
+            "format": "qcow2",
fbe740
+            "actual-size": 200704,
fbe740
+            "format-specific": {
fbe740
+                "type": "qcow2",
fbe740
+                "data": {
fbe740
+                    "compat": "1.1",
fbe740
+                    "lazy-refcounts": false,
fbe740
+                    "refcount-bits": 16,
fbe740
+                    "corrupt": false
fbe740
+                }
fbe740
+            },
fbe740
+            "dirty-flag": false
fbe740
+        },
fbe740
+        "iops_wr": 0,
fbe740
+        "ro": false,
fbe740
+        "node-name": "libvirt-1-format",
fbe740
+        "backing_file_depth": 0,
fbe740
+        "drv": "qcow2",
fbe740
+        "iops": 0,
fbe740
+        "bps_wr": 0,
fbe740
+        "write_threshold": 0,
fbe740
+        "encrypted": false,
fbe740
+        "bps": 0,
fbe740
+        "bps_rd": 0,
fbe740
+        "cache": {
fbe740
+            "no-flush": false,
fbe740
+            "direct": false,
fbe740
+            "writeback": true
fbe740
+        },
fbe740
+        "file": "/tmp/pull4.qcow2",
fbe740
+        "encryption_key_missing": false
fbe740
+    },
fbe740
+    {
fbe740
+        "iops_rd": 0,
fbe740
+        "detect_zeroes": "off",
fbe740
+        "image": {
fbe740
+            "virtual-size": 197120,
fbe740
+            "filename": "/tmp/pull4.qcow2",
fbe740
+            "format": "file",
fbe740
+            "actual-size": 200704,
fbe740
+            "dirty-flag": false
fbe740
+        },
fbe740
+        "iops_wr": 0,
fbe740
+        "ro": false,
fbe740
+        "node-name": "libvirt-1-storage",
fbe740
+        "backing_file_depth": 0,
fbe740
+        "drv": "file",
fbe740
+        "iops": 0,
fbe740
+        "bps_wr": 0,
fbe740
+        "write_threshold": 0,
fbe740
+        "encrypted": false,
fbe740
+        "bps": 0,
fbe740
+        "bps_rd": 0,
fbe740
+        "cache": {
fbe740
+            "no-flush": false,
fbe740
+            "direct": false,
fbe740
+            "writeback": true
fbe740
+        },
fbe740
+        "file": "/tmp/pull4.qcow2",
fbe740
+        "encryption_key_missing": false
fbe740
+    }
fbe740
+]
fbe740
diff --git a/tests/qemublocktestdata/bitmap/empty.out b/tests/qemublocktestdata/bitmap/empty.out
fbe740
new file mode 100644
fbe740
index 0000000000..3787cbd354
fbe740
--- /dev/null
fbe740
+++ b/tests/qemublocktestdata/bitmap/empty.out
fbe740
@@ -0,0 +1 @@
fbe740
+libvirt-1-format:
fbe740
-- 
fbe740
2.27.0
fbe740