a41c76
From 081af2b88972972f000593d10629f0f269a7ad41 Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <081af2b88972972f000593d10629f0f269a7ad41@dist-git>
a41c76
From: Peter Krempa <pkrempa@redhat.com>
a41c76
Date: Tue, 23 Jun 2020 12:23:41 +0200
a41c76
Subject: [PATCH] qemublocktest: Add 'empty' case for checkpoint deletion
a41c76
MIME-Version: 1.0
a41c76
Content-Type: text/plain; charset=UTF-8
a41c76
Content-Transfer-Encoding: 8bit
a41c76
a41c76
Use the new test data for checkpoint deletion testing. This test also
a41c76
requires modification of the internals to allow checking for test
a41c76
failure.
a41c76
a41c76
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
a41c76
Reviewed-by: Eric Blake <eblake@redhat.com>
a41c76
(cherry picked from commit 88f175d88718114c032107df102d7c8071f0a38e)
a41c76
https://bugzilla.redhat.com/show_bug.cgi?id=1804593
a41c76
Message-Id: <957325a358cad71b3002dd03c3ec656ee4f225a9.1592906423.git.pkrempa@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
---
a41c76
 tests/qemublocktest.c                               | 13 +++++++------
a41c76
 .../checkpointdelete/empty-out.json                 |  1 +
a41c76
 2 files changed, 8 insertions(+), 6 deletions(-)
a41c76
 create mode 100644 tests/qemublocktestdata/checkpointdelete/empty-out.json
a41c76
a41c76
diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
a41c76
index 3ef6ccec9b..5f1c68f6de 100644
a41c76
--- a/tests/qemublocktest.c
a41c76
+++ b/tests/qemublocktest.c
a41c76
@@ -851,14 +851,13 @@ testQemuCheckpointDeleteMerge(const void *opaque)
a41c76
                                          data->parentbitmap,
a41c76
                                          actions,
a41c76
                                          "testdisk",
a41c76
-                                         &reopenimages) < 0) {
a41c76
-        VIR_TEST_VERBOSE("failed to generate checkpoint delete transaction\n");
a41c76
-        return -1;
a41c76
+                                         &reopenimages) >= 0) {
a41c76
+        if (virJSONValueToBuffer(actions, &buf, true) < 0)
a41c76
+            return -1;
a41c76
+    } else {
a41c76
+        virBufferAddLit(&buf, "NULL\n");
a41c76
     }
a41c76
 
a41c76
-    if (virJSONValueToBuffer(actions, &buf, true) < 0)
a41c76
-        return -1;
a41c76
-
a41c76
     if (reopenimages) {
a41c76
         virBufferAddLit(&buf, "reopen nodes:\n");
a41c76
 
a41c76
@@ -1332,6 +1331,8 @@ mymain(void)
a41c76
         ret = -1; \
a41c76
     } while (0)
a41c76
 
a41c76
+    TEST_CHECKPOINT_DELETE_MERGE("empty", "a", NULL, "empty");
a41c76
+
a41c76
     TEST_CHECKPOINT_DELETE_MERGE("basic-noparent", "a", NULL, "basic");
a41c76
     TEST_CHECKPOINT_DELETE_MERGE("basic-intermediate1", "b", "a", "basic");
a41c76
     TEST_CHECKPOINT_DELETE_MERGE("basic-intermediate2", "c", "b", "basic");
a41c76
diff --git a/tests/qemublocktestdata/checkpointdelete/empty-out.json b/tests/qemublocktestdata/checkpointdelete/empty-out.json
a41c76
new file mode 100644
a41c76
index 0000000000..7951defec1
a41c76
--- /dev/null
a41c76
+++ b/tests/qemublocktestdata/checkpointdelete/empty-out.json
a41c76
@@ -0,0 +1 @@
a41c76
+NULL
a41c76
-- 
a41c76
2.27.0
a41c76