[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 11/19] tests/qtest/qos-test: dump qos graph if verbose
From: |
Paolo Bonzini |
Subject: |
[PULL 11/19] tests/qtest/qos-test: dump qos graph if verbose |
Date: |
Mon, 15 Feb 2021 14:16:18 +0100 |
From: qemu_oss--- via <qemu-devel@nongnu.org>
If qtests were run in verbose mode (i.e. if --verbose CL argument was
provided) then dump the generated qos graph (all nodes and edges,
along with their current individual availability status) to stdout,
which allows to identify problems in the created qos graph e.g. when
writing new qos tests.
See API doc comment on function qos_dump_graph() for details.
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Message-Id:
<6bffb6e38589fb2c06a2c1b5deed33f3e710fed1.1611704181.git.qemu_oss@crudebyte.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
tests/qtest/libqos/qgraph.c | 45 +++++++++++++++++++++++++++++++++++++
tests/qtest/libqos/qgraph.h | 20 +++++++++++++++++
tests/qtest/qos-test.c | 3 +++
3 files changed, 68 insertions(+)
diff --git a/tests/qtest/libqos/qgraph.c b/tests/qtest/libqos/qgraph.c
index 61faf6b27d..b3b1a31f81 100644
--- a/tests/qtest/libqos/qgraph.c
+++ b/tests/qtest/libqos/qgraph.c
@@ -805,3 +805,48 @@ void qos_delete_cmd_line(const char *name)
node->command_line = NULL;
}
}
+
+void qos_dump_graph(void)
+{
+ GList *keys;
+ GList *l;
+ QOSGraphEdgeList *list;
+ QOSGraphEdge *e, *next;
+ QOSGraphNode *dest_node, *node;
+
+ qos_printf("ALL QGRAPH EDGES: {\n");
+ keys = g_hash_table_get_keys(edge_table);
+ for (l = keys; l != NULL; l = l->next) {
+ const gchar *key = l->data;
+ qos_printf("\t src='%s'\n", key);
+ list = get_edgelist(key);
+ QSLIST_FOREACH_SAFE(e, list, edge_list, next) {
+ dest_node = g_hash_table_lookup(node_table, e->dest);
+ qos_printf("\t\t|-> dest='%s' type=%d (node=%p)",
+ e->dest, e->type, dest_node);
+ if (!dest_node) {
+ qos_printf_literal(" <------- ERROR !");
+ }
+ qos_printf_literal("\n");
+ }
+ }
+ g_list_free(keys);
+ qos_printf("}\n");
+
+ qos_printf("ALL QGRAPH NODES: {\n");
+ keys = g_hash_table_get_keys(node_table);
+ for (l = keys; l != NULL; l = l->next) {
+ const gchar *key = l->data;
+ node = g_hash_table_lookup(node_table, key);
+ qos_printf("\t name='%s' ", key);
+ if (node->qemu_name) {
+ qos_printf_literal("qemu_name='%s' ", node->qemu_name);
+ }
+ qos_printf_literal("type=%d cmd_line='%s' [%s]\n",
+ node->type, node->command_line,
+ node->available ? "available" : "UNAVAILBLE"
+ );
+ }
+ g_list_free(keys);
+ qos_printf("}\n");
+}
diff --git a/tests/qtest/libqos/qgraph.h b/tests/qtest/libqos/qgraph.h
index f472949f68..07a32535f1 100644
--- a/tests/qtest/libqos/qgraph.h
+++ b/tests/qtest/libqos/qgraph.h
@@ -586,5 +586,25 @@ QOSGraphObject *qos_machine_new(QOSGraphNode *node,
QTestState *qts);
QOSGraphObject *qos_driver_new(QOSGraphNode *node, QOSGraphObject *parent,
QGuestAllocator *alloc, void *arg);
+/**
+ * Just for debugging purpose: prints all currently existing nodes and
+ * edges to stdout.
+ *
+ * All qtests add themselves to the overall qos graph by calling qgraph
+ * functions that add device nodes and edges between the individual graph
+ * nodes for tests. As the actual graph is assmbled at runtime by the qos
+ * subsystem, it is sometimes not obvious how the overall graph looks like.
+ * E.g. when writing new tests it may happen that those new tests are simply
+ * ignored by the qtest framework.
+ *
+ * This function allows to identify problems in the created qgraph. Keep in
+ * mind: only tests with a path down from the actual test case node (leaf) up
+ * to the graph's root node are actually executed by the qtest framework. And
+ * the qtest framework uses QMP to automatically check which QEMU drivers are
+ * actually currently available, and accordingly qos marks certain pathes as
+ * 'unavailable' in such cases (e.g. when QEMU was compiled without support for
+ * a certain feature).
+ */
+void qos_dump_graph(void);
#endif
diff --git a/tests/qtest/qos-test.c b/tests/qtest/qos-test.c
index 8fdf87b183..d98ef78613 100644
--- a/tests/qtest/qos-test.c
+++ b/tests/qtest/qos-test.c
@@ -322,6 +322,9 @@ int main(int argc, char **argv)
qos_set_machines_devices_available();
qos_graph_foreach_test_path(walk_path);
+ if (g_test_verbose()) {
+ qos_dump_graph();
+ }
g_test_run();
qtest_end();
qos_graph_destroy();
--
2.29.2
- [PULL 05/19] sev/i386: Allow AP booting under SEV-ES, (continued)
- [PULL 05/19] sev/i386: Allow AP booting under SEV-ES, Paolo Bonzini, 2021/02/15
- [PULL 06/19] sev/i386: Don't allow a system reset under an SEV-ES guest, Paolo Bonzini, 2021/02/15
- [PULL 07/19] kvm/i386: Use a per-VM check for SMM capability, Paolo Bonzini, 2021/02/15
- [PULL 10/19] libqos/qgraph_internal: add qos_printf() and qos_printf_literal(), Paolo Bonzini, 2021/02/15
- [PULL 08/19] sev/i386: Enable an SEV-ES guest based on SEV policy, Paolo Bonzini, 2021/02/15
- [PULL 09/19] libqos/qgraph: add qos_node_create_driver_named(), Paolo Bonzini, 2021/02/15
[PULL 11/19] tests/qtest/qos-test: dump qos graph if verbose,
Paolo Bonzini <=
[PULL 13/19] tests/qtest/qos-test: dump QEMU command if verbose, Paolo Bonzini, 2021/02/15
[PULL 12/19] tests/qtest/qos-test: dump environment variables if verbose, Paolo Bonzini, 2021/02/15
[PULL 14/19] util/cutils: Skip "." when looking for next directory component, Paolo Bonzini, 2021/02/15
[PULL 17/19] hvf: x86: Remove unused definitions, Paolo Bonzini, 2021/02/15
[PULL 15/19] hvf: Guard xgetbv call, Paolo Bonzini, 2021/02/15
[PULL 16/19] target/i386/hvf: add vmware-cpuid-freq cpu feature, Paolo Bonzini, 2021/02/15
[PULL 18/19] target/i386/hvf: add rdmsr 35H MSR_CORE_THREAD_COUNT, Paolo Bonzini, 2021/02/15
[PULL 19/19] hvf: Fetch cr4 before evaluating CPUID(1), Paolo Bonzini, 2021/02/15
Re: [PULL 00/19] i386, qgraph patches for 2020-02-15, Thomas Huth, 2021/02/15
Re: [PULL 00/19] i386, qgraph patches for 2020-02-15, Philippe Mathieu-Daudé, 2021/02/15