|
|
1bdc94 |
From b90ea90ed89d27cadc704b664e6ca26ea32fa95d Mon Sep 17 00:00:00 2001
|
|
|
1bdc94 |
From: Markus Armbruster <armbru@redhat.com>
|
|
|
1bdc94 |
Date: Mon, 18 Jun 2018 08:43:27 +0200
|
|
|
1bdc94 |
Subject: [PATCH 20/54] check-block-qdict: Cover flattening of empty lists and
|
|
|
1bdc94 |
dictionaries
|
|
|
1bdc94 |
|
|
|
1bdc94 |
RH-Author: Markus Armbruster <armbru@redhat.com>
|
|
|
1bdc94 |
Message-id: <20180618084330.30009-21-armbru@redhat.com>
|
|
|
1bdc94 |
Patchwork-id: 80734
|
|
|
1bdc94 |
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 20/23] check-block-qdict: Cover flattening of empty lists and dictionaries
|
|
|
1bdc94 |
Bugzilla: 1557995
|
|
|
1bdc94 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
1bdc94 |
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
|
|
|
1bdc94 |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
1bdc94 |
|
|
|
1bdc94 |
Signed-off-by: Markus Armbruster <armbru@redhat.com>
|
|
|
1bdc94 |
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
1bdc94 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
1bdc94 |
(cherry picked from commit bef96b1549907b005ce1fa1456d2a0910d2a1aa5)
|
|
|
1bdc94 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
1bdc94 |
---
|
|
|
1bdc94 |
tests/check-block-qdict.c | 14 +++++++++++++-
|
|
|
1bdc94 |
1 file changed, 13 insertions(+), 1 deletion(-)
|
|
|
1bdc94 |
|
|
|
1bdc94 |
diff --git a/tests/check-block-qdict.c b/tests/check-block-qdict.c
|
|
|
1bdc94 |
index 29f58a2..2da16f0 100644
|
|
|
1bdc94 |
--- a/tests/check-block-qdict.c
|
|
|
1bdc94 |
+++ b/tests/check-block-qdict.c
|
|
|
1bdc94 |
@@ -41,6 +41,8 @@ static void qdict_flatten_test(void)
|
|
|
1bdc94 |
QList *e = qlist_new();
|
|
|
1bdc94 |
QDict *e_1_2 = qdict_new();
|
|
|
1bdc94 |
QDict *f = qdict_new();
|
|
|
1bdc94 |
+ QList *y = qlist_new();
|
|
|
1bdc94 |
+ QDict *z = qdict_new();
|
|
|
1bdc94 |
QDict *root = qdict_new();
|
|
|
1bdc94 |
|
|
|
1bdc94 |
/*
|
|
|
1bdc94 |
@@ -62,7 +64,9 @@ static void qdict_flatten_test(void)
|
|
|
1bdc94 |
* "c": 2,
|
|
|
1bdc94 |
* "d": 3,
|
|
|
1bdc94 |
* },
|
|
|
1bdc94 |
- * "g": 4
|
|
|
1bdc94 |
+ * "g": 4,
|
|
|
1bdc94 |
+ * "y": [{}],
|
|
|
1bdc94 |
+ * "z": {"a": []}
|
|
|
1bdc94 |
* }
|
|
|
1bdc94 |
*
|
|
|
1bdc94 |
* to
|
|
|
1bdc94 |
@@ -77,6 +81,8 @@ static void qdict_flatten_test(void)
|
|
|
1bdc94 |
* "f.d": 3,
|
|
|
1bdc94 |
* "g": 4
|
|
|
1bdc94 |
* }
|
|
|
1bdc94 |
+ *
|
|
|
1bdc94 |
+ * Note that "y" and "z" get eaten.
|
|
|
1bdc94 |
*/
|
|
|
1bdc94 |
|
|
|
1bdc94 |
qdict_put_int(e_1_2, "a", 0);
|
|
|
1bdc94 |
@@ -91,9 +97,15 @@ static void qdict_flatten_test(void)
|
|
|
1bdc94 |
qdict_put_int(f, "c", 2);
|
|
|
1bdc94 |
qdict_put_int(f, "d", 3);
|
|
|
1bdc94 |
|
|
|
1bdc94 |
+ qlist_append(y, qdict_new());
|
|
|
1bdc94 |
+
|
|
|
1bdc94 |
+ qdict_put(z, "a", qlist_new());
|
|
|
1bdc94 |
+
|
|
|
1bdc94 |
qdict_put(root, "e", e);
|
|
|
1bdc94 |
qdict_put(root, "f", f);
|
|
|
1bdc94 |
qdict_put_int(root, "g", 4);
|
|
|
1bdc94 |
+ qdict_put(root, "y", y);
|
|
|
1bdc94 |
+ qdict_put(root, "z", z);
|
|
|
1bdc94 |
|
|
|
1bdc94 |
qdict_flatten(root);
|
|
|
1bdc94 |
|
|
|
1bdc94 |
--
|
|
|
1bdc94 |
1.8.3.1
|
|
|
1bdc94 |
|