[libvirt] [PATCH 06/19] tests: qemublocktest: Add a syntetic test case for bitmap detection

Peter Krempa pkrempa at redhat.com
Thu Dec 12 17:18:36 UTC 2019


The real data gathered for the 'basic' test case don't excercise some
fields. Add a copy with a few values modified.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 tests/qemublocktest.c                         |   1 +
 tests/qemublocktestdata/bitmap/synthetic.json | 118 ++++++++++++++++++
 tests/qemublocktestdata/bitmap/synthetic.out  |   6 +
 3 files changed, 125 insertions(+)
 create mode 100644 tests/qemublocktestdata/bitmap/synthetic.json
 create mode 100644 tests/qemublocktestdata/bitmap/synthetic.out

diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
index 16bee47a12..e3aee03c81 100644
--- a/tests/qemublocktest.c
+++ b/tests/qemublocktest.c
@@ -776,6 +776,7 @@ mymain(void)
     } while (0)

     TEST_BITMAP_DETECT("basic");
+    TEST_BITMAP_DETECT("synthetic");

  cleanup:
     virHashFree(diskxmljsondata.schema);
diff --git a/tests/qemublocktestdata/bitmap/synthetic.json b/tests/qemublocktestdata/bitmap/synthetic.json
new file mode 100644
index 0000000000..56882bd615
--- /dev/null
+++ b/tests/qemublocktestdata/bitmap/synthetic.json
@@ -0,0 +1,118 @@
+[
+    {
+        "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,
+        "dirty-bitmaps": [
+            {
+                "name": "current",
+                "recording": true,
+                "persistent": true,
+                "busy": false,
+                "status": "active",
+                "granularity": 65536,
+                "count": 0
+            },
+            {
+                "name": "d",
+                "recording": false,
+                "persistent": false,
+                "busy": false,
+                "status": "disabled",
+                "granularity": 65536,
+                "count": 0
+            },
+            {
+                "name": "c",
+                "recording": false,
+                "persistent": true,
+                "busy": false,
+                "status": "disabled",
+                "granularity": 1234,
+                "count": 0
+            },
+            {
+                "name": "b",
+                "recording": false,
+                "persistent": true,
+                "busy": true,
+                "status": "disabled",
+                "granularity": 65536,
+                "count": 21314
+            },
+            {
+                "name": "a",
+                "recording": false,
+                "persistent": true,
+                "busy": false,
+                "status": "disabled",
+                "inconsistent": true,
+                "granularity": 65536,
+                "count": 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/synthetic.out b/tests/qemublocktestdata/bitmap/synthetic.out
new file mode 100644
index 0000000000..d941716d4b
--- /dev/null
+++ b/tests/qemublocktestdata/bitmap/synthetic.out
@@ -0,0 +1,6 @@
+libvirt-1-format:
+  current: recod:1 busy:0 persist:1 inconist:0 gran:65536 dirty:0
+        d: recod:0 busy:0 persist:0 inconist:0 gran:65536 dirty:0
+        c: recod:0 busy:0 persist:1 inconist:0 gran:1234 dirty:0
+        b: recod:0 busy:1 persist:1 inconist:0 gran:65536 dirty:21314
+        a: recod:0 busy:0 persist:1 inconist:1 gran:65536 dirty:0
-- 
2.23.0




More information about the libvir-list mailing list