From nobody Sun Nov 16 18:35:20 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=crudebyte.com ARC-Seal: i=1; a=rsa-sha256; t=1601209199; cv=none; d=zohomail.com; s=zohoarc; b=Zhofmvb8pqrpVXtb8IhqjYcPjUNScdA6Pqhd+R4YjZYr8A280AP5pw7udSVUy+ysYodqUeGeIGb16oYVFCuVqjU2vCntHsgpVxoUJMmUuVHxy1Upy0/DpK/BtG+YPQ7KHAFhx5HkoyH1ISW0L1Myr4NlE8RljcjaTrkDmjAB+qc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601209199; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=RpchxIRjTMmMwFMZr0cf7veocelrms95TEq16l9UbCI=; b=cd8RhO0R10wpZ1pRLJ6nFb8+yQF7PUT0QmJ7pDdytHM59eRhPOnJ7fUZgmDxL+p0gkZebvX6SJ2FQfVBTPwEgzVqSJWPNn2L96AAemPHlBM7LsPdtA9qVxxEPHmKjJJdVk6onc4cbgtNkRjZ73bZ0tITkYvGHP0NZ1igoVO4I5I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1601209199065150.29679820531885; Sun, 27 Sep 2020 05:19:59 -0700 (PDT) Received: from localhost ([::1]:57598 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kMVen-0003vF-QS for importer@patchew.org; Sun, 27 Sep 2020 08:19:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53024) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kMVdK-0002c0-ES for qemu-devel@nongnu.org; Sun, 27 Sep 2020 08:18:26 -0400 Received: from lizzy.crudebyte.com ([91.194.90.13]:52907) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kMVdI-0006jf-PH for qemu-devel@nongnu.org; Sun, 27 Sep 2020 08:18:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=RpchxIRjTMmMwFMZr0cf7veocelrms95TEq16l9UbCI=; b=Rjjgy 3n8LaAjKpQam7Z0TBI/9EcjqbYlPQmWY9dOfl3gxKaDIC7g/1mH+lcO9+Dn0TO8lzft2tXVZKWVXB oW6QYp1US/T7rdTwQd7uGO9KpLzcLE6OPk5z1OLyZVd6sLKt36G8y69l/tlFl1PMGC4UJUu/Y/16O G9yOVAnZv02POuRfBA70/FnJ2ya5duQgWDKdMzYJ5RlzXmcLV4sPvZ3PKajNJ5tmTdqoKDNgLVGZy 3TzZoVnjoqs7QXqUQh1Ur3VrYNMxKrZ6bWZ3kkIXp+Gd6lo9OYpdOgjiR5VcHJUCo0r5xOhRU0/gk CUkeVlMY9e22kJBIG2+bXbdx/XaNA==; Message-Id: In-Reply-To: References: From: Christian Schoenebeck Date: Sun, 27 Sep 2020 12:39:17 +0200 Subject: [PATCH 03/12] tests/qtest/qos: add qos_dump_graph() To: qemu-devel@nongnu.org Cc: Thomas Huth , Laurent Vivier , Paolo Bonzini , Emanuele Giuseppe Esposito , Greg Kurz Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=91.194.90.13; envelope-from=b40b46794184fc18bbd39d8aa7f01ca3ee1fbb2f@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/27 07:42:27 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @crudebyte.com) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This new function is purely for debugging purposes. It prints the current qos graph to stdout and allows to identify problems in the created qos graph e.g. when writing new qos tests. Signed-off-by: Christian Schoenebeck --- tests/qtest/libqos/qgraph.c | 54 +++++++++++++++++++++++++++++++++++++ tests/qtest/libqos/qgraph.h | 20 ++++++++++++++ 2 files changed, 74 insertions(+) diff --git a/tests/qtest/libqos/qgraph.c b/tests/qtest/libqos/qgraph.c index 61faf6b27d..e70635750e 100644 --- a/tests/qtest/libqos/qgraph.c +++ b/tests/qtest/libqos/qgraph.c @@ -805,3 +805,57 @@ void qos_delete_cmd_line(const char *name) node->command_line =3D NULL; } } + +#define RED(txt) ( \ + "\033[0;91m" txt \ + "\033[0m" \ +) + +#define GREEN(txt) ( \ + "\033[0;92m" txt \ + "\033[0m" \ +) + +void qos_dump_graph(void) +{ + GList *keys; + GList *l; + QOSGraphEdgeList *list; + QOSGraphEdge *e, *next; + QOSGraphNode *dest_node, *node; + + printf("ALL QGRAPH EDGES: {\n"); + keys =3D g_hash_table_get_keys(edge_table); + for (l =3D keys; l !=3D NULL; l =3D l->next) { + const gchar *key =3D l->data; + printf("\t src=3D'%s'\n", key); + list =3D get_edgelist(key); + QSLIST_FOREACH_SAFE(e, list, edge_list, next) { + dest_node =3D g_hash_table_lookup(node_table, e->dest); + printf("\t\t|-> dest=3D'%s' type=3D%d (node=3D%p)", + e->dest, e->type, dest_node); + if (!dest_node) { + printf(RED(" <------- ERROR !")); + } + printf("\n"); + } + } + g_list_free(keys); + printf("}\n"); + + printf("ALL QGRAPH NODES: {\n"); + keys =3D g_hash_table_get_keys(node_table); + for (l =3D keys; l !=3D NULL; l =3D l->next) { + const gchar *key =3D l->data; + node =3D g_hash_table_lookup(node_table, key); + printf("\t name=3D'%s' ", key); + if (node->qemu_name) { + printf("qemu_name=3D'%s' ", node->qemu_name); + } + printf("type=3D%d cmd_line=3D'%s' [%s]\n", + node->type, node->command_line, + node->available ? GREEN("available") : RED("UNAVAILBLE")); + } + g_list_free(keys); + 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, QT= estState *qts); QOSGraphObject *qos_driver_new(QOSGraphNode *node, QOSGraphObject *parent, QGuestAllocator *alloc, void *arg); =20 +/** + * 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 simp= ly + * 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 suppor= t for + * a certain feature). + */ +void qos_dump_graph(void); =20 #endif --=20 2.20.1