[libvirt] [RFC PATCH 11/16] tests: qemublock: Add few more test cases for checkpoint deletion

Peter Krempa posted 16 patches 6 years, 1 month ago
[libvirt] [RFC PATCH 11/16] tests: qemublock: Add few more test cases for checkpoint deletion
Posted by Peter Krempa 6 years, 1 month ago
Add all intermediate steps and deletion of the current checkpoint on a
flat (single-image) disk image.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 tests/qemublocktest.c                         |  4 +++
 .../checkpointdelete/basic-current-out.json   | 29 +++++++++++++++++++
 .../basic-intermediate1-out.json              | 22 ++++++++++++++
 .../basic-intermediate2-out.json              | 22 ++++++++++++++
 .../basic-intermediate3-out.json              | 22 ++++++++++++++
 5 files changed, 99 insertions(+)
 create mode 100644 tests/qemublocktestdata/checkpointdelete/basic-current-out.json
 create mode 100644 tests/qemublocktestdata/checkpointdelete/basic-intermediate1-out.json
 create mode 100644 tests/qemublocktestdata/checkpointdelete/basic-intermediate2-out.json
 create mode 100644 tests/qemublocktestdata/checkpointdelete/basic-intermediate3-out.json

diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
index 3ed2486ad2..203e0f70b1 100644
--- a/tests/qemublocktest.c
+++ b/tests/qemublocktest.c
@@ -999,6 +999,10 @@ mymain(void)
     } while (0)

     TEST_CHECKPOINT_DELETE_MERGE("basic-noparent", "a", NULL);
+    TEST_CHECKPOINT_DELETE_MERGE("basic-intermediate1", "b", "a");
+    TEST_CHECKPOINT_DELETE_MERGE("basic-intermediate2", "c", "b");
+    TEST_CHECKPOINT_DELETE_MERGE("basic-intermediate3", "d", "c");
+    TEST_CHECKPOINT_DELETE_MERGE("basic-current", "current", "d");

  cleanup:
     virHashFree(diskxmljsondata.schema);
diff --git a/tests/qemublocktestdata/checkpointdelete/basic-current-out.json b/tests/qemublocktestdata/checkpointdelete/basic-current-out.json
new file mode 100644
index 0000000000..1b607567e8
--- /dev/null
+++ b/tests/qemublocktestdata/checkpointdelete/basic-current-out.json
@@ -0,0 +1,29 @@
+[
+  {
+    "type": "block-dirty-bitmap-enable",
+    "data": {
+      "node": "libvirt-1-format",
+      "name": "d"
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-1-format",
+      "target": "d",
+      "bitmaps": [
+        {
+          "node": "libvirt-1-format",
+          "name": "current"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-remove",
+    "data": {
+      "node": "libvirt-1-format",
+      "name": "current"
+    }
+  }
+]
diff --git a/tests/qemublocktestdata/checkpointdelete/basic-intermediate1-out.json b/tests/qemublocktestdata/checkpointdelete/basic-intermediate1-out.json
new file mode 100644
index 0000000000..eccb7ed15f
--- /dev/null
+++ b/tests/qemublocktestdata/checkpointdelete/basic-intermediate1-out.json
@@ -0,0 +1,22 @@
+[
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-1-format",
+      "target": "a",
+      "bitmaps": [
+        {
+          "node": "libvirt-1-format",
+          "name": "b"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-remove",
+    "data": {
+      "node": "libvirt-1-format",
+      "name": "b"
+    }
+  }
+]
diff --git a/tests/qemublocktestdata/checkpointdelete/basic-intermediate2-out.json b/tests/qemublocktestdata/checkpointdelete/basic-intermediate2-out.json
new file mode 100644
index 0000000000..de40e4b5b0
--- /dev/null
+++ b/tests/qemublocktestdata/checkpointdelete/basic-intermediate2-out.json
@@ -0,0 +1,22 @@
+[
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-1-format",
+      "target": "b",
+      "bitmaps": [
+        {
+          "node": "libvirt-1-format",
+          "name": "c"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-remove",
+    "data": {
+      "node": "libvirt-1-format",
+      "name": "c"
+    }
+  }
+]
diff --git a/tests/qemublocktestdata/checkpointdelete/basic-intermediate3-out.json b/tests/qemublocktestdata/checkpointdelete/basic-intermediate3-out.json
new file mode 100644
index 0000000000..b5d85f43f0
--- /dev/null
+++ b/tests/qemublocktestdata/checkpointdelete/basic-intermediate3-out.json
@@ -0,0 +1,22 @@
+[
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-1-format",
+      "target": "c",
+      "bitmaps": [
+        {
+          "node": "libvirt-1-format",
+          "name": "d"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-remove",
+    "data": {
+      "node": "libvirt-1-format",
+      "name": "d"
+    }
+  }
+]
-- 
2.24.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [RFC PATCH 11/16] tests: qemublock: Add few more test cases for checkpoint deletion
Posted by Eric Blake 6 years ago
On 1/9/20 12:21 PM, Peter Krempa wrote:
> Add all intermediate steps and deletion of the current checkpoint on a
> flat (single-image) disk image.
> 
> Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> ---
>   tests/qemublocktest.c                         |  4 +++
>   .../checkpointdelete/basic-current-out.json   | 29 +++++++++++++++++++
>   .../basic-intermediate1-out.json              | 22 ++++++++++++++
>   .../basic-intermediate2-out.json              | 22 ++++++++++++++
>   .../basic-intermediate3-out.json              | 22 ++++++++++++++
>   5 files changed, 99 insertions(+)
>   create mode 100644 tests/qemublocktestdata/checkpointdelete/basic-current-out.json
>   create mode 100644 tests/qemublocktestdata/checkpointdelete/basic-intermediate1-out.json
>   create mode 100644 tests/qemublocktestdata/checkpointdelete/basic-intermediate2-out.json
>   create mode 100644 tests/qemublocktestdata/checkpointdelete/basic-intermediate3-out.json
> 

> +++ b/tests/qemublocktestdata/checkpointdelete/basic-current-out.json
> @@ -0,0 +1,29 @@
> +[
> +  {
> +    "type": "block-dirty-bitmap-enable",
> +    "data": {
> +      "node": "libvirt-1-format",
> +      "name": "d"
> +    }
> +  },
> +  {
> +    "type": "block-dirty-bitmap-merge",
> +    "data": {
> +      "node": "libvirt-1-format",
> +      "target": "d",
> +      "bitmaps": [
> +        {
> +          "node": "libvirt-1-format",
> +          "name": "current"
> +        }
> +      ]
> +    }
> +  },
> +  {
> +    "type": "block-dirty-bitmap-remove",
> +    "data": {
> +      "node": "libvirt-1-format",
> +      "name": "current"
> +    }
> +  }
> +]

Creates a rather large transaction (3 items, of which one itself takes 
an array of bitmaps), but that's par for the course.  The test looks good.

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org