From nobody Fri May 3 13:07:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1495246246827899.167674494692; Fri, 19 May 2017 19:10:46 -0700 (PDT) Received: from localhost ([::1]:60908 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dBtqv-0001PJ-9C for importer@patchew.org; Fri, 19 May 2017 22:10:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44999) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dBtpb-0000jq-42 for qemu-devel@nongnu.org; Fri, 19 May 2017 22:09:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dBtpX-0005PQ-UW for qemu-devel@nongnu.org; Fri, 19 May 2017 22:09:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37634) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dBtpX-0005PG-LT for qemu-devel@nongnu.org; Fri, 19 May 2017 22:09:19 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9A08B61D3F for ; Sat, 20 May 2017 02:09:18 +0000 (UTC) Received: from localhost (ovpn-116-71.gru2.redhat.com [10.97.116.71]) by smtp.corp.redhat.com (Postfix) with ESMTP id 229C374AD8; Sat, 20 May 2017 02:09:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9A08B61D3F Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=ehabkost@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 9A08B61D3F From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Fri, 19 May 2017 23:09:12 -0300 Message-Id: <20170520020914.14562-2-ehabkost@redhat.com> In-Reply-To: <20170520020914.14562-1-ehabkost@redhat.com> References: <20170520020914.14562-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Sat, 20 May 2017 02:09:18 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [RFC 1/3] tests: Simplify abstract-interfaces check with a helper X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add a new type_list_find() helper to device-introspect-test.c, to simplify the code at test_abstract_interfaces(). Signed-off-by: Eduardo Habkost --- tests/device-introspect-test.c | 43 ++++++++++++++++++++++++--------------= ---- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/tests/device-introspect-test.c b/tests/device-introspect-test.c index b1abb2ad89..f1e6dddfa3 100644 --- a/tests/device-introspect-test.c +++ b/tests/device-introspect-test.c @@ -45,6 +45,22 @@ static QList *qom_list_types(const char *implements, boo= l abstract) return ret; } =20 +/* Find an entry on a list returned by qom-list-types */ +static QDict *type_list_find(QList *types, const char *name) +{ + QListEntry *e; + + QLIST_FOREACH_ENTRY(types, e) { + QDict *d =3D qobject_to_qdict(qlist_entry_obj(e)); + const char *ename =3D qdict_get_str(d, "name"); + if (!strcmp(ename, name)) { + return d; + } + } + + return NULL; +} + static QList *device_type_list(bool abstract) { return qom_list_types("device", abstract); @@ -125,7 +141,7 @@ static void test_abstract_interfaces(void) { QList *all_types; QList *obj_types; - QListEntry *ae; + QListEntry *e; =20 qtest_start(common_args); /* qom-list-types implements=3Dinterface would return any type @@ -138,24 +154,15 @@ static void test_abstract_interfaces(void) all_types =3D qom_list_types(NULL, false); obj_types =3D qom_list_types("object", false); =20 - QLIST_FOREACH_ENTRY(all_types, ae) { - QDict *at =3D qobject_to_qdict(qlist_entry_obj(ae)); - const char *aname =3D qdict_get_str(at, "name"); - QListEntry *oe; - const char *found =3D NULL; - - QLIST_FOREACH_ENTRY(obj_types, oe) { - QDict *ot =3D qobject_to_qdict(qlist_entry_obj(oe)); - const char *oname =3D qdict_get_str(ot, "name"); - if (!strcmp(aname, oname)) { - found =3D oname; - break; - } - } + QLIST_FOREACH_ENTRY(all_types, e) { + QDict *d =3D qobject_to_qdict(qlist_entry_obj(e)); + + /* + * An interface (incorrectly) marked as non-abstract would + * appear on all_types, but not on obj_types: + */ + g_assert(type_list_find(obj_types, qdict_get_str(d, "name"))); =20 - /* Using g_assert_cmpstr() will give more useful failure - * messages than g_assert(found) */ - g_assert_cmpstr(aname, =3D=3D, found); } =20 QDECREF(all_types); --=20 2.11.0.259.g40922b1 From nobody Fri May 3 13:07:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1495246327364344.36735500324266; Fri, 19 May 2017 19:12:07 -0700 (PDT) Received: from localhost ([::1]:60910 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dBtsD-0002Co-M9 for importer@patchew.org; Fri, 19 May 2017 22:12:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45001) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dBtpb-0000js-4G for qemu-devel@nongnu.org; Fri, 19 May 2017 22:09:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dBtpZ-0005Pt-KG for qemu-devel@nongnu.org; Fri, 19 May 2017 22:09:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54152) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dBtpZ-0005Pg-B7 for qemu-devel@nongnu.org; Fri, 19 May 2017 22:09:21 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6B02981245 for ; Sat, 20 May 2017 02:09:20 +0000 (UTC) Received: from localhost (ovpn-116-71.gru2.redhat.com [10.97.116.71]) by smtp.corp.redhat.com (Postfix) with ESMTP id EBBFC18ECD; Sat, 20 May 2017 02:09:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6B02981245 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=ehabkost@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 6B02981245 From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Fri, 19 May 2017 23:09:13 -0300 Message-Id: <20170520020914.14562-3-ehabkost@redhat.com> In-Reply-To: <20170520020914.14562-1-ehabkost@redhat.com> References: <20170520020914.14562-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Sat, 20 May 2017 02:09:20 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [RFC 2/3] qmp: Include 'abstract' field on 'qom-list-types' output X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" A client may be interested in getting the list of both abstract and non-abstract types. Instead of requiring them to make multiple queries with different filter arguments, just return an 'abstract' field in 'qom-list-types'. In addition to the new test code for validating this field, update the abstract-interfaces test case to query for all 'interface' subtypes (including abstract ones), and to look at the 'abstract' field directly. Signed-off-by: Eduardo Habkost --- qapi-schema.json | 5 ++++- qmp.c | 1 + tests/device-introspect-test.c | 51 +++++++++++++++++++++++++++++++-------= ---- 3 files changed, 43 insertions(+), 14 deletions(-) diff --git a/qapi-schema.json b/qapi-schema.json index 80603cfc51..cbf1e2a837 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -3034,12 +3034,15 @@ # # @name: the type name found in the search # +# @abstract: the type is abstract and can't be directly instantiated +# (since 2.10) +# # Since: 1.1 # # Notes: This command is experimental and may change syntax in future rele= ases. ## { 'struct': 'ObjectTypeInfo', - 'data': { 'name': 'str' } } + 'data': { 'name': 'str', 'abstract': 'bool' } } =20 ## # @qom-list-types: diff --git a/qmp.c b/qmp.c index f656940769..8066705dbe 100644 --- a/qmp.c +++ b/qmp.c @@ -443,6 +443,7 @@ static void qom_list_types_tramp(ObjectClass *klass, vo= id *data) =20 info =3D g_malloc0(sizeof(*info)); info->name =3D g_strdup(object_class_get_name(klass)); + info->abstract =3D object_class_is_abstract(klass); =20 e =3D g_malloc0(sizeof(*e)); e->value =3D info; diff --git a/tests/device-introspect-test.c b/tests/device-introspect-test.c index f1e6dddfa3..d5aacb4ed1 100644 --- a/tests/device-introspect-test.c +++ b/tests/device-introspect-test.c @@ -103,6 +103,31 @@ static void test_device_intro_list(void) qtest_end(); } =20 +static void test_qom_list_fields(void) +{ + QList *all_types; + QList *non_abstract; + QListEntry *e; + + qtest_start(common_args); + + all_types =3D qom_list_types(NULL, true); + non_abstract =3D qom_list_types(NULL, false); + + QLIST_FOREACH_ENTRY(all_types, e) { + QDict *d =3D qobject_to_qdict(qlist_entry_obj(e)); + const char *name =3D qdict_get_str(d, "name"); + bool abstract =3D qdict_get_bool(d, "abstract"); + bool expected_abstract =3D !type_list_find(non_abstract, name); + + g_assert(abstract =3D=3D expected_abstract); + } + + QDECREF(all_types); + QDECREF(non_abstract); + qtest_end(); +} + static void test_device_intro_none(void) { qtest_start(common_args); @@ -144,25 +169,24 @@ static void test_abstract_interfaces(void) QListEntry *e; =20 qtest_start(common_args); - /* qom-list-types implements=3Dinterface would return any type - * that implements _any_ interface (not just interface types), - * so use a trick to find the interface type names: - * - list all object types - * - list all types, and look for items that are not - * on the first list + /* + * qom-list-types implements=3Dinterface returns all types that + * implement _any_ interface (not just interface types), but + * we can filter them out because interfaces don't implement + * the "object" type. */ - all_types =3D qom_list_types(NULL, false); - obj_types =3D qom_list_types("object", false); + all_types =3D qom_list_types("interface", true); + obj_types =3D qom_list_types("object", true); =20 QLIST_FOREACH_ENTRY(all_types, e) { QDict *d =3D qobject_to_qdict(qlist_entry_obj(e)); =20 - /* - * An interface (incorrectly) marked as non-abstract would - * appear on all_types, but not on obj_types: - */ - g_assert(type_list_find(obj_types, qdict_get_str(d, "name"))); + if (type_list_find(obj_types, qdict_get_str(d, "name"))) { + /* Not an interface type */ + continue; + } =20 + g_assert(qdict_get_bool(d, "abstract")); } =20 QDECREF(all_types); @@ -175,6 +199,7 @@ int main(int argc, char **argv) g_test_init(&argc, &argv, NULL); =20 qtest_add_func("device/introspect/list", test_device_intro_list); + qtest_add_func("device/introspect/list-fields", test_qom_list_fields); qtest_add_func("device/introspect/none", test_device_intro_none); qtest_add_func("device/introspect/abstract", test_device_intro_abstrac= t); qtest_add_func("device/introspect/concrete", test_device_intro_concret= e); --=20 2.11.0.259.g40922b1 From nobody Fri May 3 13:07:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1495246398513682.309560562985; Fri, 19 May 2017 19:13:18 -0700 (PDT) Received: from localhost ([::1]:60912 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dBttN-0002yQ-8V for importer@patchew.org; Fri, 19 May 2017 22:13:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45023) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dBtpc-0000k5-P7 for qemu-devel@nongnu.org; Fri, 19 May 2017 22:09:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dBtpb-0005QU-GR for qemu-devel@nongnu.org; Fri, 19 May 2017 22:09:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56288) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dBtpb-0005Q6-7Y for qemu-devel@nongnu.org; Fri, 19 May 2017 22:09:23 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 48B844E040 for ; Sat, 20 May 2017 02:09:22 +0000 (UTC) Received: from localhost (ovpn-116-71.gru2.redhat.com [10.97.116.71]) by smtp.corp.redhat.com (Postfix) with ESMTP id CEA7D74AD8; Sat, 20 May 2017 02:09:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 48B844E040 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=ehabkost@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 48B844E040 From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Fri, 19 May 2017 23:09:14 -0300 Message-Id: <20170520020914.14562-4-ehabkost@redhat.com> In-Reply-To: <20170520020914.14562-1-ehabkost@redhat.com> References: <20170520020914.14562-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Sat, 20 May 2017 02:09:22 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [RFC 3/3] qmp: Include parent types on 'qom-list-types' output X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Include list of parent types of each type on 'qom-list-types' output. Without this, there's no way to figure out the parents of a given type without making additional 'qom-list-types' queries. In addition to the test case for the new feature, update the abstract-interface test case to use the new field and avoid the "qom-list-types implements=3Dobject" trick. Signed-off-by: Eduardo Habkost --- I would to include a "interfaces" field in the future, too, but this would require extending the core QOM API to allow that. --- qapi-schema.json | 6 ++++- qmp.c | 16 +++++++++++ tests/device-introspect-test.c | 61 +++++++++++++++++++++++++++++++++++---= ---- 3 files changed, 72 insertions(+), 11 deletions(-) diff --git a/qapi-schema.json b/qapi-schema.json index cbf1e2a837..169dfd2d7f 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -3037,12 +3037,16 @@ # @abstract: the type is abstract and can't be directly instantiated # (since 2.10) # +# @parent-types: parent types. Parent types implemented by the type. Not= e that +# this doesn't include interface names also implemented by the t= ype. +# (since 2.10) +# # Since: 1.1 # # Notes: This command is experimental and may change syntax in future rele= ases. ## { 'struct': 'ObjectTypeInfo', - 'data': { 'name': 'str', 'abstract': 'bool' } } + 'data': { 'name': 'str', 'abstract': 'bool', 'parent-types': [ 'str' ] }= } =20 ## # @qom-list-types: diff --git a/qmp.c b/qmp.c index 8066705dbe..5b50f6f650 100644 --- a/qmp.c +++ b/qmp.c @@ -436,6 +436,21 @@ void qmp_change(const char *device, const char *target, } } =20 +static strList *qom_type_get_parents(ObjectClass *klass) +{ + ObjectClass *parent =3D object_class_get_parent(klass); + strList *r =3D NULL; + + if (!parent) { + return NULL; + } + + r =3D g_new0(strList, 1); + r->value =3D g_strdup(object_class_get_name(parent)); + r->next =3D qom_type_get_parents(parent); + return r; +} + static void qom_list_types_tramp(ObjectClass *klass, void *data) { ObjectTypeInfoList *e, **pret =3D data; @@ -444,6 +459,7 @@ static void qom_list_types_tramp(ObjectClass *klass, vo= id *data) info =3D g_malloc0(sizeof(*info)); info->name =3D g_strdup(object_class_get_name(klass)); info->abstract =3D object_class_is_abstract(klass); + info->parent_types =3D qom_type_get_parents(klass); =20 e =3D g_malloc0(sizeof(*e)); e->value =3D info; diff --git a/tests/device-introspect-test.c b/tests/device-introspect-test.c index d5aacb4ed1..350b862f3b 100644 --- a/tests/device-introspect-test.c +++ b/tests/device-introspect-test.c @@ -61,6 +61,20 @@ static QDict *type_list_find(QList *types, const char *n= ame) return NULL; } =20 +static bool str_list_has(QList *strlist, const char *str) +{ + QListEntry *e; + + QLIST_FOREACH_ENTRY(strlist, e) { + const char *s =3D qstring_get_str(qobject_to_qstring(qlist_entry_o= bj(e))); + if (!strcmp(s, str)) { + return true; + } + } + + return false; +} + static QList *device_type_list(bool abstract) { return qom_list_types("device", abstract); @@ -103,6 +117,31 @@ static void test_device_intro_list(void) qtest_end(); } =20 +/* + * Ensure all entries returned by qom-list-types implements=3D + * have in parent-types. + */ +static void test_qom_list_parents(const char *parent) +{ + QList *types; + QListEntry *e; + + types =3D qom_list_types(parent, true); + + QLIST_FOREACH_ENTRY(types, e) { + QDict *d =3D qobject_to_qdict(qlist_entry_obj(e)); + + /* The parent type being queried is included in the list too, skip= it */ + if (!strcmp(qdict_get_str(d, "name"), parent)) { + continue; + } + + g_assert(str_list_has(qdict_get_qlist(d, "parent-types"), parent)); + } + + QDECREF(types); +} + static void test_qom_list_fields(void) { QList *all_types; @@ -123,6 +162,10 @@ static void test_qom_list_fields(void) g_assert(abstract =3D=3D expected_abstract); } =20 + test_qom_list_parents("object"); + test_qom_list_parents("device"); + test_qom_list_parents("sys-bus-device"); + QDECREF(all_types); QDECREF(non_abstract); qtest_end(); @@ -165,23 +208,22 @@ static void test_device_intro_concrete(void) static void test_abstract_interfaces(void) { QList *all_types; - QList *obj_types; QListEntry *e; =20 qtest_start(common_args); - /* - * qom-list-types implements=3Dinterface returns all types that - * implement _any_ interface (not just interface types), but - * we can filter them out because interfaces don't implement - * the "object" type. - */ + all_types =3D qom_list_types("interface", true); - obj_types =3D qom_list_types("object", true); =20 QLIST_FOREACH_ENTRY(all_types, e) { QDict *d =3D qobject_to_qdict(qlist_entry_obj(e)); =20 - if (type_list_find(obj_types, qdict_get_str(d, "name"))) { + /* + * qom-list-types implements=3Dinterface returns all types + * that implement _any_ interface (not just interface + * types), so skip the ones that don't have "interface" + * on parent-types. + */ + if (!str_list_has(qdict_get_qlist(d, "parent-types"), "interface")= ) { /* Not an interface type */ continue; } @@ -190,7 +232,6 @@ static void test_abstract_interfaces(void) } =20 QDECREF(all_types); - QDECREF(obj_types); qtest_end(); } =20 --=20 2.11.0.259.g40922b1