[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v9 6/7] iotests.py: introduce VM.assert_edges_list() method
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[PATCH v9 6/7] iotests.py: introduce VM.assert_edges_list() method |
Date: |
Wed, 26 Jun 2024 14:53:49 +0300 |
Add an alternative method to check block graph, to be used in further
commit.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
---
tests/qemu-iotests/iotests.py | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index ea48af4a7b..8a5fd01eac 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -1108,6 +1108,23 @@ def check_bitmap_status(self, node_name, bitmap_name,
fields):
return fields.items() <= ret.items()
+ def get_block_graph(self):
+ """
+ Returns block graph in form of edges list, where each edge is a tuple:
+ (parent_node_name, child_name, child_node_name)
+ """
+ graph = self.qmp('x-debug-query-block-graph')['return']
+
+ nodes = {n['id']: n['name'] for n in graph['nodes']}
+ # Check that all names are unique:
+ assert len(set(nodes.values())) == len(nodes)
+
+ return [(nodes[e['parent']], e['name'], nodes[e['child']])
+ for e in graph['edges']]
+
+ def assert_edges_list(self, edges):
+ assert sorted(edges) == sorted(self.get_block_graph())
+
def assert_block_path(self, root, path, expected_node, graph=None):
"""
Check whether the node under the given path in the block graph
--
2.34.1
- [PATCH v9 0/7] blockdev-replace, Vladimir Sementsov-Ogievskiy, 2024/06/26
- [PATCH v9 2/7] block/export: add blk_by_export_id(), Vladimir Sementsov-Ogievskiy, 2024/06/26
- [PATCH v9 6/7] iotests.py: introduce VM.assert_edges_list() method,
Vladimir Sementsov-Ogievskiy <=
- [PATCH v9 1/7] block-backend: blk_root(): drop const specifier on return type, Vladimir Sementsov-Ogievskiy, 2024/06/26
- [PATCH v9 3/7] block: make bdrv_find_child() function public, Vladimir Sementsov-Ogievskiy, 2024/06/26
- [PATCH v9 7/7] iotests: add filter-insertion, Vladimir Sementsov-Ogievskiy, 2024/06/26
- [PATCH v9 4/7] qapi: add blockdev-replace command, Vladimir Sementsov-Ogievskiy, 2024/06/26
- [PATCH v9 5/7] block: bdrv_get_xdbg_block_graph(): report export ids, Vladimir Sementsov-Ogievskiy, 2024/06/26