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