render / rpms / libvirt

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