render / rpms / libvirt

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