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