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