From nobody Tue Apr 30 07:54:19 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 1490207968025205.4101590139045; Wed, 22 Mar 2017 11:39:28 -0700 (PDT) Received: from localhost ([::1]:52802 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqlAM-0002bM-7a for importer@patchew.org; Wed, 22 Mar 2017 14:39:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41338) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cql7T-0008GK-Ov for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cql7Q-0000XR-Gn for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34834) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cql7Q-0000WL-Ak for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:24 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2711A3D96B for ; Wed, 22 Mar 2017 18:36:24 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E7FFDAAAD0 for ; Wed, 22 Mar 2017 18:36:23 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 5E1671138648; Wed, 22 Mar 2017 19:36:21 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2711A3D96B Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=armbru@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 2711A3D96B From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 19:36:05 +0100 Message-Id: <1490207781-18965-2-git-send-email-armbru@redhat.com> In-Reply-To: <1490207781-18965-1-git-send-email-armbru@redhat.com> References: <1490207781-18965-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 22 Mar 2017 18:36:24 +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] [PULL v3 for-2.9 01/17] test-keyval: Tweaks to improve list coverage 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: , 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" We have a negative test case for a list index with leading zero. Add positive ones. Tweak the test case for list index greater or equal the number of elements: test "equal" instead of "greater" to guard against off-by-one mistakes. Signed-off-by: Markus Armbruster Message-Id: <1490014548-15083-2-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake --- tests/test-keyval.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test-keyval.c b/tests/test-keyval.c index 71288b0..e97f6d5 100644 --- a/tests/test-keyval.c +++ b/tests/test-keyval.c @@ -218,14 +218,14 @@ static void test_keyval_parse_list(void) QDECREF(qdict); =20 /* Multiple indexes, last one wins */ - qdict =3D keyval_parse("list.1=3Dgoner,list.0=3Dnull,list.1=3Deins,lis= t.2=3Dzwei", + qdict =3D keyval_parse("list.1=3Dgoner,list.0=3Dnull,list.01=3Deins,li= st.2=3Dzwei", NULL, &error_abort); g_assert_cmpint(qdict_size(qdict), =3D=3D, 1); check_list012(qdict_get_qlist(qdict, "list")); QDECREF(qdict); =20 /* List at deeper nesting */ - qdict =3D keyval_parse("a.list.1=3Deins,a.list.0=3Dnull,a.list.2=3Dzwe= i", + qdict =3D keyval_parse("a.list.1=3Deins,a.list.00=3Dnull,a.list.2=3Dzw= ei", NULL, &error_abort); g_assert_cmpint(qdict_size(qdict), =3D=3D, 1); sub_qdict =3D qdict_get_qdict(qdict, "a"); @@ -242,7 +242,7 @@ static void test_keyval_parse_list(void) g_assert(!qdict); =20 /* Missing list indexes */ - qdict =3D keyval_parse("list.2=3Dlonely", NULL, &err); + qdict =3D keyval_parse("list.1=3Dlonely", NULL, &err); error_free_or_abort(&err); g_assert(!qdict); qdict =3D keyval_parse("list.0=3Dnull,list.2=3Deins,list.02=3Dzwei", N= ULL, &err); --=20 2.7.4 From nobody Tue Apr 30 07:54:19 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 1490208550266228.49281877237343; Wed, 22 Mar 2017 11:49:10 -0700 (PDT) Received: from localhost ([::1]:52848 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqlJl-0002dy-2I for importer@patchew.org; Wed, 22 Mar 2017 14:49:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41342) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cql7T-0008GP-Pk for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cql7Q-0000Xg-J1 for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60978) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cql7Q-0000WP-AN for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:24 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 250AF67BA8 for ; Wed, 22 Mar 2017 18:36:24 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E557D80F6A for ; Wed, 22 Mar 2017 18:36:23 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 612CD113864C; Wed, 22 Mar 2017 19:36:21 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 250AF67BA8 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=armbru@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 250AF67BA8 From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 19:36:06 +0100 Message-Id: <1490207781-18965-3-git-send-email-armbru@redhat.com> In-Reply-To: <1490207781-18965-1-git-send-email-armbru@redhat.com> References: <1490207781-18965-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 22 Mar 2017 18:36:24 +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] [PULL v3 for-2.9 02/17] keyval: Improve some comments 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: , 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" Signed-off-by: Markus Armbruster Message-Id: <1490014548-15083-3-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake --- util/keyval.c | 47 +++++++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/util/keyval.c b/util/keyval.c index f646b36..46cd540 100644 --- a/util/keyval.c +++ b/util/keyval.c @@ -21,22 +21,36 @@ * * Semantics defined by reduction to JSON: * - * key-vals is a tree of objects and arrays rooted at object R - * where for each key-val =3D key-fragment . ... =3D val in key-vals - * R op key-fragment op ... =3D val' - * where (left-associative) op is - * array subscript L[key-fragment] for numeric key-fragment - * member reference L.key-fragment otherwise - * val' is val with ',,' replaced by ',' - * and only R may be empty. + * key-vals specifies a JSON object, i.e. a tree whose root is an + * object, inner nodes other than the root are objects or arrays, + * and leaves are strings. * - * Duplicate keys are permitted; all but the last one are ignored. + * Each key-val =3D key-fragment '.' ... '=3D' val specifies a path from + * root to a leaf (left of '=3D'), and the leaf's value (right of + * '=3D'). * - * The equations must have a solution. Counter-example: a.b=3D1,a=3D2 - * doesn't have one, because R.a must be an object to satisfy a.b=3D1 - * and a string to satisfy a=3D2. + * A path from the root is defined recursively: + * L '.' key-fragment is a child of the node denoted by path L + * key-fragment is a child of the tree root + * If key-fragment is numeric, the parent is an array and the child + * is its key-fragment-th member, counting from zero. + * Else, the parent is an object, and the child is its member named + * key-fragment. * - * Key-fragments must be valid QAPI names or consist only of digits. + * This constrains inner nodes to be either array or object. The + * constraints must be satisfiable. Counter-example: a.b=3D1,a=3D2 is + * not, because root.a must be an object to satisfy a.b=3D1 and a + * string to satisfy a=3D2. + * + * Array subscripts can occur in any order, but the set of + * subscripts must not have gaps. For instance, a.1=3Dv is not okay, + * because root.a[0] is missing. + * + * If multiple key-val denote the same leaf, the last one determines + * the value. + * + * Key-fragments must be valid QAPI names or consist only of decimal + * digits. * * The length of any key-fragment must be between 1 and 127. * @@ -64,8 +78,8 @@ =20 /* * Convert @key to a list index. - * Convert all leading digits to a (non-negative) number, capped at - * INT_MAX. + * Convert all leading decimal digits to a (non-negative) number, + * capped at INT_MAX. * If @end is non-null, assign a pointer to the first character after * the number to *@end. * Else, fail if any characters follow. @@ -337,7 +351,8 @@ static QObject *keyval_listify(QDict *cur, GSList *key_= of_cur, Error **errp) } =20 /* - * Make a list from @elt[], reporting any missing elements. + * Make a list from @elt[], reporting the first missing element, + * if any. * If we dropped an index >=3D nelt in the previous loop, this loop * will run into the sentinel and report index @nelt missing. */ --=20 2.7.4 From nobody Tue Apr 30 07:54:19 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 1490208030220642.3571202863112; Wed, 22 Mar 2017 11:40:30 -0700 (PDT) Received: from localhost ([::1]:52809 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqlBN-0003a7-0o for importer@patchew.org; Wed, 22 Mar 2017 14:40:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41345) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cql7T-0008GS-Q1 for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cql7Q-0000Xb-IW for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59480) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cql7Q-0000WS-9l for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:24 -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 5203C342C64 for ; Wed, 22 Mar 2017 18:36:24 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E83EA1820A for ; Wed, 22 Mar 2017 18:36:23 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 646921138651; Wed, 22 Mar 2017 19:36:21 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5203C342C64 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=armbru@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 5203C342C64 From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 19:36:07 +0100 Message-Id: <1490207781-18965-4-git-send-email-armbru@redhat.com> In-Reply-To: <1490207781-18965-1-git-send-email-armbru@redhat.com> References: <1490207781-18965-1-git-send-email-armbru@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]); Wed, 22 Mar 2017 18:36:24 +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] [PULL v3 for-2.9 03/17] test-keyval: Cover alternate and 'any' type 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: , 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" Signed-off-by: Markus Armbruster Message-Id: <1490014548-15083-4-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake --- tests/Makefile.include | 2 +- tests/test-keyval.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++= ++++ 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/tests/Makefile.include b/tests/Makefile.include index 402e71c..86f9490 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -736,7 +736,7 @@ tests/vhost-user-test$(EXESUF): tests/vhost-user-test.o= $(test-util-obj-y) \ $(chardev-obj-y) tests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_s= cm_helper.o tests/test-qemu-opts$(EXESUF): tests/test-qemu-opts.o $(test-util-obj-y) -tests/test-keyval$(EXESUF): tests/test-keyval.o $(test-util-obj-y) +tests/test-keyval$(EXESUF): tests/test-keyval.o $(test-util-obj-y) $(test-= qapi-obj-y) tests/test-write-threshold$(EXESUF): tests/test-write-threshold.o $(test-b= lock-obj-y) tests/test-netfilter$(EXESUF): tests/test-netfilter.o $(qtest-obj-y) tests/test-filter-mirror$(EXESUF): tests/test-filter-mirror.o $(qtest-obj-= y) diff --git a/tests/test-keyval.c b/tests/test-keyval.c index e97f6d5..ba19560 100644 --- a/tests/test-keyval.c +++ b/tests/test-keyval.c @@ -14,6 +14,7 @@ #include "qapi/error.h" #include "qapi/qmp/qstring.h" #include "qapi/qobject-input-visitor.h" +#include "test-qapi-visit.h" #include "qemu/cutils.h" #include "qemu/option.h" =20 @@ -608,6 +609,56 @@ static void test_keyval_visit_optional(void) visit_free(v); } =20 +static void test_keyval_visit_alternate(void) +{ + Error *err =3D NULL; + Visitor *v; + QDict *qdict; + AltNumStr *ans; + AltNumInt *ani; + + /* + * Can't do scalar alternate variants other than string. You get + * the string variant if there is one, else an error. + */ + qdict =3D keyval_parse("a=3D1,b=3D2", NULL, &error_abort); + v =3D qobject_input_visitor_new_keyval(QOBJECT(qdict)); + QDECREF(qdict); + visit_start_struct(v, NULL, NULL, 0, &error_abort); + visit_type_AltNumStr(v, "a", &ans, &error_abort); + g_assert_cmpint(ans->type, =3D=3D, QTYPE_QSTRING); + g_assert_cmpstr(ans->u.s, =3D=3D, "1"); + visit_type_AltNumInt(v, "a", &ani, &err); + error_free_or_abort(&err); + visit_end_struct(v, NULL); + visit_free(v); +} + +static void test_keyval_visit_any(void) +{ + Visitor *v; + QDict *qdict; + QObject *any; + QList *qlist; + QString *qstr; + + qdict =3D keyval_parse("a.0=3Dnull,a.1=3D1", NULL, &error_abort); + v =3D qobject_input_visitor_new_keyval(QOBJECT(qdict)); + QDECREF(qdict); + visit_start_struct(v, NULL, NULL, 0, &error_abort); + visit_type_any(v, "a", &any, &error_abort); + qlist =3D qobject_to_qlist(any); + g_assert(qlist); + qstr =3D qobject_to_qstring(qlist_pop(qlist)); + g_assert_cmpstr(qstring_get_str(qstr), =3D=3D, "null"); + qstr =3D qobject_to_qstring(qlist_pop(qlist)); + g_assert_cmpstr(qstring_get_str(qstr), =3D=3D, "1"); + g_assert(qlist_empty(qlist)); + visit_check_struct(v, &error_abort); + visit_end_struct(v, NULL); + visit_free(v); +} + int main(int argc, char *argv[]) { g_test_init(&argc, &argv, NULL); @@ -619,6 +670,8 @@ int main(int argc, char *argv[]) g_test_add_func("/keyval/visit/dict", test_keyval_visit_dict); g_test_add_func("/keyval/visit/list", test_keyval_visit_list); g_test_add_func("/keyval/visit/optional", test_keyval_visit_optional); + g_test_add_func("/keyval/visit/alternate", test_keyval_visit_alternate= ); + g_test_add_func("/keyval/visit/any", test_keyval_visit_any); g_test_run(); return 0; } --=20 2.7.4 From nobody Tue Apr 30 07:54:19 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 1490207891986992.6879693094106; Wed, 22 Mar 2017 11:38:11 -0700 (PDT) Received: from localhost ([::1]:52796 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cql98-0001Ya-0J for importer@patchew.org; Wed, 22 Mar 2017 14:38:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41343) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cql7T-0008GQ-QH for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cql7Q-0000XN-Gj for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58376) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cql7Q-0000WO-Af for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:24 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 29A0081F07 for ; Wed, 22 Mar 2017 18:36:24 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EAB6380F8B for ; Wed, 22 Mar 2017 18:36:23 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 6755C11386CB; Wed, 22 Mar 2017 19:36:21 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 29A0081F07 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=armbru@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 29A0081F07 From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 19:36:08 +0100 Message-Id: <1490207781-18965-5-git-send-email-armbru@redhat.com> In-Reply-To: <1490207781-18965-1-git-send-email-armbru@redhat.com> References: <1490207781-18965-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 22 Mar 2017 18:36:24 +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] [PULL v3 for-2.9 04/17] keyval: Document issues with 'any' and alternate types 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: , 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" Signed-off-by: Markus Armbruster Message-Id: <1490014548-15083-5-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake --- util/keyval.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/util/keyval.c b/util/keyval.c index 46cd540..93d5db6 100644 --- a/util/keyval.c +++ b/util/keyval.c @@ -61,6 +61,16 @@ * "key absent" already means "optional object/array absent", which * isn't the same as "empty object/array present". * + * Design flaw: scalar values can only be strings; there is no way to + * denote numbers, true, false or null. The special QObject input + * visitor returned by qobject_input_visitor_new_keyval() mostly hides + * this by automatically converting strings to the type the visitor + * expects. Breaks down for alternate types and type 'any', where the + * visitor's expectation isn't clear. Code visiting such types needs + * to do the conversion itself, but only when using this keyval + * visitor. Awkward. Alternate types without a string member don't + * work at all. + * * Additional syntax for use with an implied key: * * key-vals-ik =3D val-no-key [ ',' key-vals ] --=20 2.7.4 From nobody Tue Apr 30 07:54:19 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 1490208170125803.7187449827325; Wed, 22 Mar 2017 11:42:50 -0700 (PDT) Received: from localhost ([::1]:52819 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqlDc-0005mH-FW for importer@patchew.org; Wed, 22 Mar 2017 14:42:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41348) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cql7T-0008GV-Qz for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cql7R-0000ZS-SX for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58426) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cql7R-0000YF-M5 for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:25 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B00918E670 for ; Wed, 22 Mar 2017 18:36:25 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 75EF9852A0 for ; Wed, 22 Mar 2017 18:36:25 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 6A5CB11385E2; Wed, 22 Mar 2017 19:36:21 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B00918E670 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=armbru@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com B00918E670 From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 19:36:09 +0100 Message-Id: <1490207781-18965-6-git-send-email-armbru@redhat.com> In-Reply-To: <1490207781-18965-1-git-send-email-armbru@redhat.com> References: <1490207781-18965-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 22 Mar 2017 18:36:25 +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] [PULL v3 for-2.9 05/17] MAINTAINERS: Add myself for files I touched recently 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: , 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" Signed-off-by: Markus Armbruster Message-Id: <1490014548-15083-6-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake --- MAINTAINERS | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 779c429..c60235e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1231,6 +1231,15 @@ M: Samuel Thibault S: Maintained F: backends/baum.c =20 +Command line option argument parsing +M: Markus Armbruster +S: Supported +F: include/qemu/option.h +F: tests/test-keyval.c +F: tests/test-qemu-opts.c +F: util/keyval.c +F: util/qemu-option.c + Coverity model M: Markus Armbruster S: Supported @@ -1365,7 +1374,9 @@ X: include/qapi/qmp/ F: include/qapi/qmp/dispatch.h F: tests/qapi-schema/ F: tests/test-*-visitor.c +F: tests/test-qapi-*.c F: tests/test-qmp-*.c +F: tests/test-visitor-serialization.c F: scripts/qapi* F: docs/qapi* T: git git://repo.or.cz/qemu/armbru.git qapi-next --=20 2.7.4 From nobody Tue Apr 30 07:54:19 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 1490208417062605.2084199711887; Wed, 22 Mar 2017 11:46:57 -0700 (PDT) Received: from localhost ([::1]:52837 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqlHb-0000zi-OJ for importer@patchew.org; Wed, 22 Mar 2017 14:46:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41352) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cql7T-0008GX-Qx for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cql7R-0000Z6-P3 for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59550) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cql7R-0000Y5-K2 for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:25 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A505664DAC for ; Wed, 22 Mar 2017 18:36:25 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 72FA3800F9 for ; Wed, 22 Mar 2017 18:36:25 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 6D3DD11385EF; Wed, 22 Mar 2017 19:36:21 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A505664DAC 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=armbru@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com A505664DAC From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 19:36:10 +0100 Message-Id: <1490207781-18965-7-git-send-email-armbru@redhat.com> In-Reply-To: <1490207781-18965-1-git-send-email-armbru@redhat.com> References: <1490207781-18965-1-git-send-email-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 22 Mar 2017 18:36:25 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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] [PULL v3 for-2.9 06/17] qapi: Drop excessive Make dependencies on qapi2texi.py 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When qapi2texi.py changes, we regenerate everything QAPI. Screwed up in commit 56e8bdd. Signed-off-by: Markus Armbruster Message-Id: <1490015515-25851-2-git-send-email-armbru@redhat.com> Reviewed-by: Marc-Andr=C3=A9 Lureau --- Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index f4f90df..6c359b2 100644 --- a/Makefile +++ b/Makefile @@ -392,7 +392,6 @@ qemu-ga$(EXESUF): QEMU_CFLAGS +=3D -I qga/qapi-generated gen-out-type =3D $(subst .,-,$(suffix $@)) =20 qapi-py =3D $(SRC_PATH)/scripts/qapi.py $(SRC_PATH)/scripts/ordereddict.py -qapi-py +=3D $(SRC_PATH)/scripts/qapi2texi.py =20 qga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h :\ $(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-= py) @@ -701,10 +700,12 @@ qemu-monitor-info.texi: $(SRC_PATH)/hmp-commands-info= .hx $(SRC_PATH)/scripts/hxt qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/scripts/hxtool $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"GEN","$@= ") =20 -docs/qemu-qmp-qapi.texi: $(qapi-modules) $(qapi-py) +docs/qemu-qmp-qapi.texi docs/qemu-ga-qapi.texi: $(SRC_PATH)/scripts/qapi2t= exi.py $(qapi-py) + +docs/qemu-qmp-qapi.texi: $(qapi-modules) $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi2texi.py $< > $@,"= GEN","$@") =20 -docs/qemu-ga-qapi.texi: $(SRC_PATH)/qga/qapi-schema.json $(qapi-py) +docs/qemu-ga-qapi.texi: $(SRC_PATH)/qga/qapi-schema.json $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi2texi.py $< > $@,"= GEN","$@") =20 qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi qemu-monitor-inf= o.texi --=20 2.7.4 From nobody Tue Apr 30 07:54:19 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 1490207892646937.3843566207311; Wed, 22 Mar 2017 11:38:12 -0700 (PDT) Received: from localhost ([::1]:52798 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cql99-0001Zi-CL for importer@patchew.org; Wed, 22 Mar 2017 14:38:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41344) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cql7T-0008GR-Px for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cql7R-0000Ze-UO for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57862) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cql7R-0000Y7-MF for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:25 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AD8A464A73 for ; Wed, 22 Mar 2017 18:36:25 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7C227852A9 for ; Wed, 22 Mar 2017 18:36:25 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 7006E11385FD; Wed, 22 Mar 2017 19:36:21 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com AD8A464A73 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=armbru@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com AD8A464A73 From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 19:36:11 +0100 Message-Id: <1490207781-18965-8-git-send-email-armbru@redhat.com> In-Reply-To: <1490207781-18965-1-git-send-email-armbru@redhat.com> References: <1490207781-18965-1-git-send-email-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 22 Mar 2017 18:36:25 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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] [PULL v3 for-2.9 07/17] qapi2texi: Fix to actually fail when 'doc-required' is false 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Messed up in commit bc52d03. Signed-off-by: Markus Armbruster Message-Id: <1490015515-25851-3-git-send-email-armbru@redhat.com> Reviewed-by: Marc-Andr=C3=A9 Lureau --- scripts/qapi2texi.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/qapi2texi.py b/scripts/qapi2texi.py index 8eed11a..5c4db78 100755 --- a/scripts/qapi2texi.py +++ b/scripts/qapi2texi.py @@ -292,6 +292,7 @@ def main(argv): if not qapi.doc_required: print >>sys.stderr, ("%s: need pragma 'doc-required' " "to generate documentation" % argv[0]) + sys.exit(1) print texi_schema(schema) =20 =20 --=20 2.7.4 From nobody Tue Apr 30 07:54:19 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 1490208106037894.8143101303102; Wed, 22 Mar 2017 11:41:46 -0700 (PDT) Received: from localhost ([::1]:52815 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqlCa-0004cO-Nx for importer@patchew.org; Wed, 22 Mar 2017 14:41:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41353) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cql7T-0008GY-RD for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cql7R-0000Zm-VF for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39860) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cql7R-0000YC-Mo for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:25 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AFACFC0567A2 for ; Wed, 22 Mar 2017 18:36:25 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 78324852A1 for ; Wed, 22 Mar 2017 18:36:25 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 72E021138606; Wed, 22 Mar 2017 19:36:21 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com AFACFC0567A2 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=armbru@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com AFACFC0567A2 From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 19:36:12 +0100 Message-Id: <1490207781-18965-9-git-send-email-armbru@redhat.com> In-Reply-To: <1490207781-18965-1-git-send-email-armbru@redhat.com> References: <1490207781-18965-1-git-send-email-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 22 Mar 2017 18:36:25 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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] [PULL v3 for-2.9 08/17] qapi: Drop unused QAPIDoc member optional 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Unused since commit aa964b7 "qapi2texi: Convert to QAPISchemaVisitor" Signed-off-by: Markus Armbruster Message-Id: <1490015515-25851-4-git-send-email-armbru@redhat.com> Reviewed-by: Marc-Andr=C3=A9 Lureau --- scripts/qapi.py | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/qapi.py b/scripts/qapi.py index e88c047..6c4d554 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -106,7 +106,6 @@ class QAPIDoc(object): self.name =3D name # the list of lines for this section self.content =3D [] - self.optional =3D False =20 def append(self, line): self.content.append(line) --=20 2.7.4 From nobody Tue Apr 30 07:54:19 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 1490208417452568.6279588773598; Wed, 22 Mar 2017 11:46:57 -0700 (PDT) Received: from localhost ([::1]:52838 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqlHc-00010w-4u for importer@patchew.org; Wed, 22 Mar 2017 14:46:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41523) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cql7X-0008Jv-PD for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cql7R-0000ZQ-TF for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53246) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cql7R-0000YD-MR for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:25 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B0571C04BD42 for ; Wed, 22 Mar 2017 18:36:25 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 785D7852A7 for ; Wed, 22 Mar 2017 18:36:25 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 75DA91138609; Wed, 22 Mar 2017 19:36:21 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B0571C04BD42 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=armbru@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com B0571C04BD42 From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 19:36:13 +0100 Message-Id: <1490207781-18965-10-git-send-email-armbru@redhat.com> In-Reply-To: <1490207781-18965-1-git-send-email-armbru@redhat.com> References: <1490207781-18965-1-git-send-email-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 22 Mar 2017 18:36:25 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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] [PULL v3 for-2.9 09/17] tests/qapi-schema: Make test-qapi.py print docs again 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" test-qapi.py used to print the internal representation of doc comments (commit 3313b61). This went away when we dropped the doc comments in positive tests (commit 87c16dc). Bring it back, because I'm going to add real positive doc comment tests. Signed-off-by: Markus Armbruster Message-Id: <1490015515-25851-5-git-send-email-armbru@redhat.com> Reviewed-by: Marc-Andr=C3=A9 Lureau --- tests/qapi-schema/test-qapi.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/qapi-schema/test-qapi.py b/tests/qapi-schema/test-qapi.py index ef74e2c..c7724d3 100644 --- a/tests/qapi-schema/test-qapi.py +++ b/tests/qapi-schema/test-qapi.py @@ -55,3 +55,14 @@ class QAPISchemaTestVisitor(QAPISchemaVisitor): =20 schema =3D QAPISchema(sys.argv[1]) schema.visit(QAPISchemaTestVisitor()) + +for doc in schema.docs: + if doc.symbol: + print 'doc symbol=3D%s' % doc.symbol + else: + print 'doc freeform' + print ' body=3D\n%s' % doc.body + for arg, section in doc.args.iteritems(): + print ' arg=3D%s\n%s' % (arg, section) + for section in doc.sections: + print ' section=3D%s\n%s' % (section.name, section) --=20 2.7.4 From nobody Tue Apr 30 07:54:19 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 1490208300126913.9425094707703; Wed, 22 Mar 2017 11:45:00 -0700 (PDT) Received: from localhost ([::1]:52827 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqlFi-0007p0-Ia for importer@patchew.org; Wed, 22 Mar 2017 14:44:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41443) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cql7V-0008Hl-In for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cql7S-0000a6-7U for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57880) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cql7R-0000Yb-Vj for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:26 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 057308F039 for ; Wed, 22 Mar 2017 18:36:26 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 756ED800C0 for ; Wed, 22 Mar 2017 18:36:25 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 78CE4113860E; Wed, 22 Mar 2017 19:36:21 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 057308F039 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=armbru@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 057308F039 From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 19:36:14 +0100 Message-Id: <1490207781-18965-11-git-send-email-armbru@redhat.com> In-Reply-To: <1490207781-18965-1-git-send-email-armbru@redhat.com> References: <1490207781-18965-1-git-send-email-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 22 Mar 2017 18:36:26 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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] [PULL v3 for-2.9 10/17] tests/qapi-schema: Systematic positive doc comment tests 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We have a number of negative tests, but we don't have systematic positive coverage. Fix that. Signed-off-by: Markus Armbruster Message-Id: <1490015515-25851-6-git-send-email-armbru@redhat.com> Reviewed-by: Marc-Andr=C3=A9 Lureau --- tests/Makefile.include | 13 ++- tests/qapi-schema/doc-good.err | 0 tests/qapi-schema/doc-good.exit | 1 + tests/qapi-schema/doc-good.json | 136 ++++++++++++++++++++++ tests/qapi-schema/doc-good.out | 148 ++++++++++++++++++++++++ tests/qapi-schema/doc-good.texi | 243 ++++++++++++++++++++++++++++++++++++= ++++ 6 files changed, 537 insertions(+), 4 deletions(-) create mode 100644 tests/qapi-schema/doc-good.err create mode 100644 tests/qapi-schema/doc-good.exit create mode 100644 tests/qapi-schema/doc-good.json create mode 100644 tests/qapi-schema/doc-good.out create mode 100644 tests/qapi-schema/doc-good.texi diff --git a/tests/Makefile.include b/tests/Makefile.include index 86f9490..f3de81f 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -379,6 +379,7 @@ qapi-schema +=3D doc-duplicated-since.json qapi-schema +=3D doc-empty-arg.json qapi-schema +=3D doc-empty-section.json qapi-schema +=3D doc-empty-symbol.json +qapi-schema +=3D doc-good.json qapi-schema +=3D doc-interleaved-section.json qapi-schema +=3D doc-invalid-end.json qapi-schema +=3D doc-invalid-end2.json @@ -607,6 +608,9 @@ $(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json $(S= RC_PATH)/scripts/qapi-int $(gen-out-type) -o tests -p "test-" $<, \ "GEN","$@") =20 +tests/qapi-schema/doc-good.test.texi: $(SRC_PATH)/tests/qapi-schema/doc-go= od.json $(SRC_PATH)/scripts/qapi2texi.py $(qapi-py) + $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi2texi.py $< > $@,"= GEN","$@") + tests/test-string-output-visitor$(EXESUF): tests/test-string-output-visito= r.o $(test-qapi-obj-y) tests/test-string-input-visitor$(EXESUF): tests/test-string-input-visitor.= o $(test-qapi-obj-y) tests/test-qmp-event$(EXESUF): tests/test-qmp-event.o $(test-qapi-obj-y) @@ -856,9 +860,6 @@ QEMU_IOTESTS_HELPERS-$(CONFIG_LINUX) =3D tests/qemu-iot= ests/socket_scm_helper$(EXE check-tests/qemu-iotests-quick.sh: tests/qemu-iotests-quick.sh qemu-img$(E= XESUF) qemu-io$(EXESUF) $(QEMU_IOTESTS_HELPERS-y) $< =20 -.PHONY: check-tests/test-qapi.py -check-tests/test-qapi.py: tests/test-qapi.py - .PHONY: $(patsubst %, check-%, $(check-qapi-schema-y)) $(patsubst %, check-%, $(check-qapi-schema-y)): check-%.json: $(SRC_PATH)/= %.json $(call quiet-command, PYTHONPATH=3D$(SRC_PATH)/scripts \ @@ -871,10 +872,14 @@ $(patsubst %, check-%, $(check-qapi-schema-y)): check= -%.json: $(SRC_PATH)/%.json @perl -p -e 's|\Q$(SRC_PATH)\E/||g' $*.test.err | diff -q $(SRC_PATH)/$*.= err - @diff -q $(SRC_PATH)/$*.exit $*.test.exit =20 +.PHONY: check-tests/qapi-schema/doc-good.texi +check-tests/qapi-schema/doc-good.texi: tests/qapi-schema/doc-good.test.texi + @diff -q $(SRC_PATH)/tests/qapi-schema/doc-good.texi $< + # Consolidated targets =20 .PHONY: check-qapi-schema check-qtest check-unit check check-clean -check-qapi-schema: $(patsubst %,check-%, $(check-qapi-schema-y)) +check-qapi-schema: $(patsubst %,check-%, $(check-qapi-schema-y)) check-tes= ts/qapi-schema/doc-good.texi check-qtest: $(patsubst %,check-qtest-%, $(QTEST_TARGETS)) check-unit: $(patsubst %,check-%, $(check-unit-y)) check-block: $(patsubst %,check-%, $(check-block-y)) diff --git a/tests/qapi-schema/doc-good.err b/tests/qapi-schema/doc-good.err new file mode 100644 index 0000000..e69de29 diff --git a/tests/qapi-schema/doc-good.exit b/tests/qapi-schema/doc-good.e= xit new file mode 100644 index 0000000..573541a --- /dev/null +++ b/tests/qapi-schema/doc-good.exit @@ -0,0 +1 @@ +0 diff --git a/tests/qapi-schema/doc-good.json b/tests/qapi-schema/doc-good.j= son new file mode 100644 index 0000000..cfdc0a8 --- /dev/null +++ b/tests/qapi-schema/doc-good.json @@ -0,0 +1,136 @@ +# -*- Mode: Python -*- +# Positive QAPI doc comment tests + +{ 'pragma': { 'doc-required': true } } + +## +# =3D Section +# +# =3D=3D Subsection +# +# *strong* _with emphasis_ +# @var {in braces} +# * List item one +# - Two, multiple +# lines +# +# 3. Three +# Still in list +# +# Not in list +# - Second list +# Note: still in list +# +# Note: not in list +# 1. Third list +# is numbered +# +# - another item +# +# | example +# | multiple lines +# +# Returns: the King +# Since: the first age +# Notes: +# +# 1. Lorem ipsum dolor sit amet +# +# 2. Ut enim ad minim veniam +# +# Duis aute irure dolor +# +# Example: +# +# -> in +# <- out +# Examples: +# - *verbatim* +# - {braces} +## + +## +# @Enum: +# =3D=3D Produces *invalid* texinfo +# @one: The _one_ {and only} +# +# @two is undocumented +## +{ 'enum': 'Enum', 'data': [ 'one', 'two' ] } + +## +# @Base: +# @base1: +# the first member +## +{ 'struct': 'Base', 'data': { 'base1': 'Enum' } } + +## +# @Variant1: +# A paragraph +# +# Another paragraph (but no @var: line) +## +{ 'struct': 'Variant1', 'data': { 'var1': 'str' } } + +## +# @Variant2: +## +{ 'struct': 'Variant2', 'data': {} } + +## +# @Object: +## +{ 'union': 'Object', + 'base': 'Base', + 'discriminator': 'base1', + 'data': { 'one': 'Variant1', 'two': 'Variant2' } } + +## +# @SugaredUnion: +## +{ 'union': 'SugaredUnion', + 'data': { 'one': 'Variant1', 'two': 'Variant2' } } + +## +# =3D=3D Another subsection +## + +## +# @cmd: +# @arg1: the first argument +# +# @arg2: the second +# argument +# Note: @arg3 is undocumented +# Returns: @Object +# TODO: frobnicate +# Notes: +# - Lorem ipsum dolor sit amet +# - Ut enim ad minim veniam +# +# Duis aute irure dolor +# Example: +# +# -> in +# <- out +# Examples: +# - *verbatim* +# - {braces} +# Since: 2.10 +## +{ 'command': 'cmd', + 'data': { 'arg1': 'int', '*arg2': 'str', 'arg3': 'bool' }, + 'returns': 'Object' } + +## +# @cmd-boxed: +# If you're bored enough to read this, go see a video of boxed cats +# Example: +# +# -> in +# +# <- out +## +{ 'command': 'cmd-boxed', 'boxed': true, + 'data': 'Object' } diff --git a/tests/qapi-schema/doc-good.out b/tests/qapi-schema/doc-good.out new file mode 100644 index 0000000..70c1252 --- /dev/null +++ b/tests/qapi-schema/doc-good.out @@ -0,0 +1,148 @@ +object Base + member base1: Enum optional=3DFalse +enum Enum ['one', 'two'] +object Object + base Base + tag base1 + case one: Variant1 + case two: Variant2 +enum QType ['none', 'qnull', 'qint', 'qstring', 'qdict', 'qlist', 'qfloat'= , 'qbool'] + prefix QTYPE +object SugaredUnion + member type: SugaredUnionKind optional=3DFalse + tag type + case one: q_obj_Variant1-wrapper + case two: q_obj_Variant2-wrapper +enum SugaredUnionKind ['one', 'two'] +object Variant1 + member var1: str optional=3DFalse +object Variant2 +command cmd q_obj_cmd-arg -> Object + gen=3DTrue success_response=3DTrue boxed=3DFalse +command cmd-boxed Object -> None + gen=3DTrue success_response=3DTrue boxed=3DTrue +object q_empty +object q_obj_Variant1-wrapper + member data: Variant1 optional=3DFalse +object q_obj_Variant2-wrapper + member data: Variant2 optional=3DFalse +object q_obj_cmd-arg + member arg1: int optional=3DFalse + member arg2: str optional=3DTrue + member arg3: bool optional=3DFalse +doc freeform + body=3D +=3D Section + +=3D=3D Subsection + +*strong* _with emphasis_ +@var {in braces} +* List item one +- Two, multiple +lines + +3. Three +Still in list + +Not in list +- Second list +Note: still in list + +Note: not in list +1. Third list +is numbered + +- another item + +| example +| multiple lines + +Returns: the King +Since: the first age +Notes: + +1. Lorem ipsum dolor sit amet + +2. Ut enim ad minim veniam + +Duis aute irure dolor + +Example: + +-> in +<- out +Examples: +- *verbatim* +- {braces} +doc symbol=3DEnum + body=3D +=3D=3D Produces *invalid* texinfo + arg=3Done +The _one_ {and only} + arg=3Dtwo + + section=3D +@two is undocumented +doc symbol=3DBase + body=3D + + arg=3Dbase1 +the first member +doc symbol=3DVariant1 + body=3D +A paragraph + +Another paragraph (but no @var: line) + arg=3Dvar1 + +doc symbol=3DVariant2 + body=3D + +doc symbol=3DObject + body=3D + +doc symbol=3DSugaredUnion + body=3D + + arg=3Dtype + +doc freeform + body=3D +=3D=3D Another subsection +doc symbol=3Dcmd + body=3D + + arg=3Darg1 +the first argument + arg=3Darg2 +the second +argument + arg=3Darg3 + + section=3DNote +@arg3 is undocumented + section=3DReturns +@Object + section=3DTODO +frobnicate + section=3DNotes +- Lorem ipsum dolor sit amet +- Ut enim ad minim veniam + +Duis aute irure dolor + section=3DExample +-> in +<- out + section=3DExamples +- *verbatim* +- {braces} + section=3DSince +2.10 +doc symbol=3Dcmd-boxed + body=3D +If you're bored enough to read this, go see a video of boxed cats + section=3DExample +-> in + +<- out diff --git a/tests/qapi-schema/doc-good.texi b/tests/qapi-schema/doc-good.t= exi new file mode 100644 index 0000000..1160aaf --- /dev/null +++ b/tests/qapi-schema/doc-good.texi @@ -0,0 +1,243 @@ +@section Section + +@subsection Subsection + +@emph{strong} @emph{with emphasis}=20 +@code{var} @{in braces@} +@itemize @bullet +@item +List item one +@item +Two, multiple +lines + +@item +Three +Still in list + +@end itemize + +Not in list +@itemize @minus +@item +Second list +Note: still in list + +@end itemize + +Note: not in list +@enumerate +@item +Third list +is numbered + +@item +another item + +@example +example +@end example + +@example +multiple lines +@end example + + +@end enumerate + +Returns: the King +Since: the first age +Notes: + +@enumerate +@item +Lorem ipsum dolor sit amet + +@item +Ut enim ad minim veniam + +@end enumerate + +Duis aute irure dolor + +Example: + +-> in +<- out +Examples: +@itemize @minus +@item +@emph{verbatim} +@item +@{braces@} +@end itemize + + + +@deftp {Enum} Enum + +@subsection Produces @emph{invalid} texinfo + +@b{Values:} +@table @asis +@item @code{one} +The @emph{one} @{and only@} +@item @code{two} +Not documented +@end table +@code{two} is undocumented + +@end deftp + + + +@deftp {Object} Base + + + +@b{Members:} +@table @asis +@item @code{base1: Enum} +the first member +@end table + + +@end deftp + + + +@deftp {Object} Variant1 + +A paragraph + +Another paragraph (but no @code{var}: line) + +@b{Members:} +@table @asis +@item @code{var1: string} +Not documented +@end table + + +@end deftp + + + +@deftp {Object} Variant2 + + + + +@end deftp + + + +@deftp {Object} Object + + + +@b{Members:} +@table @asis +@item The members of @code{Base} +@item The members of @code{Variant1} when @code{base1} is @t{"one"} +@item The members of @code{Variant2} when @code{base1} is @t{"two"} +@end table + + +@end deftp + + + +@deftp {Object} SugaredUnion + + + +@b{Members:} +@table @asis +@item @code{type} +One of @t{"one"}, @t{"two"} +@item @code{data: Variant1} when @code{type} is @t{"one"} +@item @code{data: Variant2} when @code{type} is @t{"two"} +@end table + + +@end deftp + + +@subsection Another subsection + + +@deftypefn Command {} cmd + + + +@b{Arguments:} +@table @asis +@item @code{arg1: int} +the first argument +@item @code{arg2: string} (optional) +the second +argument +@item @code{arg3: boolean} +Not documented +@end table + + +@b{Note:} +@code{arg3} is undocumented + +@b{Returns:} +@code{Object} + +@b{TODO:} +frobnicate + +@b{Notes:} +@itemize @minus +@item +Lorem ipsum dolor sit amet +@item +Ut enim ad minim veniam + +@end itemize + +Duis aute irure dolor + +@b{Example:} +@example +-> in +<- out +@end example + + +@b{Examples:} +@example +- *verbatim* +- @{braces@} +@end example + + +@b{Since:} +2.10 + +@end deftypefn + + + +@deftypefn Command {} cmd-boxed + +If you're bored enough to read this, go see a video of boxed cats + +@b{Arguments:} the members of @code{Object} + +@b{Example:} +@example +-> in + +<- out +@end example + + +@end deftypefn + + --=20 2.7.4 From nobody Tue Apr 30 07:54:19 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 14902081691021003.8707861687835; Wed, 22 Mar 2017 11:42:49 -0700 (PDT) Received: from localhost ([::1]:52817 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqlDb-0005jV-Rv for importer@patchew.org; Wed, 22 Mar 2017 14:42:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41346) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cql7T-0008GT-Q5 for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cql7R-0000ZR-SX for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32792) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cql7R-0000Y8-MP for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:25 -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 AD34F8EA48 for ; Wed, 22 Mar 2017 18:36:25 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 77E4518210 for ; Wed, 22 Mar 2017 18:36:25 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 7B9BA1138612; Wed, 22 Mar 2017 19:36:21 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com AD34F8EA48 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=armbru@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com AD34F8EA48 From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 19:36:15 +0100 Message-Id: <1490207781-18965-12-git-send-email-armbru@redhat.com> In-Reply-To: <1490207781-18965-1-git-send-email-armbru@redhat.com> References: <1490207781-18965-1-git-send-email-armbru@redhat.com> MIME-Version: 1.0 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.28]); Wed, 22 Mar 2017 18:36:25 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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] [PULL v3 for-2.9 11/17] qapi2texi: Fix translation of *strong* and _emphasized_ 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Markus Armbruster Message-Id: <1490015515-25851-7-git-send-email-armbru@redhat.com> Reviewed-by: Marc-Andr=C3=A9 Lureau --- scripts/qapi2texi.py | 4 ++-- tests/qapi-schema/doc-good.texi | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/qapi2texi.py b/scripts/qapi2texi.py index 5c4db78..9e01500 100755 --- a/scripts/qapi2texi.py +++ b/scripts/qapi2texi.py @@ -35,12 +35,12 @@ EXAMPLE_FMT =3D """@example =20 def subst_strong(doc): """Replaces *foo* by @strong{foo}""" - return re.sub(r'\*([^*\n]+)\*', r'@emph{\1}', doc) + return re.sub(r'\*([^*\n]+)\*', r'@strong{\1}', doc) =20 =20 def subst_emph(doc): """Replaces _foo_ by @emph{foo}""" - return re.sub(r'\b_([^_\n]+)_\b', r' @emph{\1} ', doc) + return re.sub(r'\b_([^_\n]+)_\b', r'@emph{\1}', doc) =20 =20 def subst_vars(doc): diff --git a/tests/qapi-schema/doc-good.texi b/tests/qapi-schema/doc-good.t= exi index 1160aaf..c410626 100644 --- a/tests/qapi-schema/doc-good.texi +++ b/tests/qapi-schema/doc-good.texi @@ -2,7 +2,7 @@ =20 @subsection Subsection =20 -@emph{strong} @emph{with emphasis}=20 +@strong{strong} @emph{with emphasis} @code{var} @{in braces@} @itemize @bullet @item @@ -67,7 +67,7 @@ Example: Examples: @itemize @minus @item -@emph{verbatim} +@strong{verbatim} @item @{braces@} @end itemize @@ -76,12 +76,12 @@ Examples: =20 @deftp {Enum} Enum =20 -@subsection Produces @emph{invalid} texinfo +@subsection Produces @strong{invalid} texinfo =20 @b{Values:} @table @asis @item @code{one} -The @emph{one} @{and only@} +The @emph{one} @{and only@} @item @code{two} Not documented @end table --=20 2.7.4 From nobody Tue Apr 30 07:54:19 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 1490207893307859.9107071760325; Wed, 22 Mar 2017 11:38:13 -0700 (PDT) Received: from localhost ([::1]:52797 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cql99-0001Yj-UW for importer@patchew.org; Wed, 22 Mar 2017 14:38:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41354) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cql7T-0008GZ-RY for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cql7R-0000ZH-RD for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34866) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cql7R-0000Y9-Lb for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:25 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AF69042BBF for ; Wed, 22 Mar 2017 18:36:25 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 78C0B852A8 for ; Wed, 22 Mar 2017 18:36:25 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 7E7631138617; Wed, 22 Mar 2017 19:36:21 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com AF69042BBF Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=armbru@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com AF69042BBF From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 19:36:16 +0100 Message-Id: <1490207781-18965-13-git-send-email-armbru@redhat.com> In-Reply-To: <1490207781-18965-1-git-send-email-armbru@redhat.com> References: <1490207781-18965-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 22 Mar 2017 18:36:25 +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] [PULL v3 for-2.9 12/17] qapi: Fix string input visitor regression for empty lists 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: , 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" Visiting a list when input is the empty string should result in an empty list, not an error. Noticed when commit 3d089ce belatedly added tests, but simply accepted as weird then. It's actually a regression: broken in commit 74f24cb, v2.7.0. Fix it, and throw in another test case for empty string. Signed-off-by: Markus Armbruster Message-Id: <1490026424-11330-2-git-send-email-armbru@redhat.com> Reviewed-by: Michael Roth Reviewed-by: Eric Blake --- qapi/string-input-visitor.c | 4 ++++ tests/test-string-input-visitor.c | 11 ++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/qapi/string-input-visitor.c b/qapi/string-input-visitor.c index 806b01ae..c089491 100644 --- a/qapi/string-input-visitor.c +++ b/qapi/string-input-visitor.c @@ -54,6 +54,10 @@ static int parse_str(StringInputVisitor *siv, const char= *name, Error **errp) return 0; } =20 + if (!*str) { + return 0; + } + do { errno =3D 0; start =3D strtoll(str, &endptr, 0); diff --git a/tests/test-string-input-visitor.c b/tests/test-string-input-vi= sitor.c index 6db850b..79313a7 100644 --- a/tests/test-string-input-visitor.c +++ b/tests/test-string-input-visitor.c @@ -63,6 +63,11 @@ static void test_visitor_in_int(TestInputVisitorData *da= ta, =20 visit_type_int(v, NULL, &res, &err); error_free_or_abort(&err); + + v =3D visitor_input_test_init(data, ""); + + visit_type_int(v, NULL, &res, &err); + error_free_or_abort(&err); } =20 static void check_ilist(Visitor *v, int64_t *expected, size_t n) @@ -140,11 +145,11 @@ static void test_visitor_in_intList(TestInputVisitorD= ata *data, v =3D visitor_input_test_init(data, "18446744073709551615"); check_ulist(v, expect4, ARRAY_SIZE(expect4)); =20 - /* Empty list is invalid (weird) */ + /* Empty list */ =20 v =3D visitor_input_test_init(data, ""); - visit_type_int64List(v, NULL, &res, &err); - error_free_or_abort(&err); + visit_type_int64List(v, NULL, &res, &error_abort); + g_assert(!res); =20 /* Not a list */ =20 --=20 2.7.4 From nobody Tue Apr 30 07:54:19 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 1490208031700923.1698230932892; Wed, 22 Mar 2017 11:40:31 -0700 (PDT) Received: from localhost ([::1]:52810 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqlBO-0003bG-G3 for importer@patchew.org; Wed, 22 Mar 2017 14:40:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41339) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cql7T-0008GN-Pj for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cql7S-0000aF-Cd for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35392) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cql7S-0000Ye-47 for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:26 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1BBE92E605A; Wed, 22 Mar 2017 18:36:26 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9E75F852AB; Wed, 22 Mar 2017 18:36:25 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 815A9113861A; Wed, 22 Mar 2017 19:36:21 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1BBE92E605A Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=armbru@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 1BBE92E605A From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 19:36:17 +0100 Message-Id: <1490207781-18965-14-git-send-email-armbru@redhat.com> In-Reply-To: <1490207781-18965-1-git-send-email-armbru@redhat.com> References: <1490207781-18965-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 22 Mar 2017 18:36:26 +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] [PULL v3 for-2.9 13/17] Revert "hostmem: fix QEMU crash by 'info memdev'" 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: Paolo Bonzini , Xiao Guangrong 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" This reverts commit 1454d33f0507cb54d62ed80f494884157c9e7130. The string input visitor regression fixed in the previous commit made visit_type_uint16List() fail on empty input. query_memdev() calls it via object_property_get_uint16List(). Because it doesn't expect it to fail, it passes &error_abort, and duly crashes. Commit 1454d33 "fixes" this crash by making host_memory_backend_get_host_nodes() return a list containing just MAX_NODES instead of the empty list. Papers over the regression, and leads to bogus "info memdev" output, as shown below; revert. I suspect that if we had bisected the crash back then, we would have found and fixed the actual bug instead of papering over it. To reproduce, run HMP command "info memdev" with $ qemu-system-x86_64 --nodefaults -S -display none -monitor stdio -obje= ct memory-backend-ram,id=3Dmem1,size=3D4k With this commit, "info memdev" prints memory backend: mem1 size: 4096 merge: true dump: true prealloc: false policy: default host nodes: exactly like before commit 74f24cb. Between commit 1454d33 and this commit, it prints memory backend: mem1 size: 4096 merge: true dump: true prealloc: false policy: default host nodes: 128 The last line is bogus. Between commit 74f24cb and 1454d33, it crashes like this: Unexpected error in parse_str() at /work/armbru/tmp/qemu/qapi/string-in= put-visitor.c:126: Parameter 'null' expects an int64 value or range Aborted (core dumped) Cc: Xiao Guangrong Cc: Paolo Bonzini Signed-off-by: Markus Armbruster Message-Id: <1490026424-11330-3-git-send-email-armbru@redhat.com> Reviewed-by: Michael Roth Reviewed-by: Eric Blake --- backends/hostmem.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/backends/hostmem.c b/backends/hostmem.c index 162c218..89feb9e 100644 --- a/backends/hostmem.c +++ b/backends/hostmem.c @@ -64,14 +64,6 @@ out: error_propagate(errp, local_err); } =20 -static uint16List **host_memory_append_node(uint16List **node, - unsigned long value) -{ - *node =3D g_malloc0(sizeof(**node)); - (*node)->value =3D value; - return &(*node)->next; -} - static void host_memory_backend_get_host_nodes(Object *obj, Visitor *v, const char *na= me, void *opaque, Error **errp) @@ -82,23 +74,25 @@ host_memory_backend_get_host_nodes(Object *obj, Visitor= *v, const char *name, unsigned long value; =20 value =3D find_first_bit(backend->host_nodes, MAX_NODES); - - node =3D host_memory_append_node(node, value); - if (value =3D=3D MAX_NODES) { - goto out; + return; } =20 + *node =3D g_malloc0(sizeof(**node)); + (*node)->value =3D value; + node =3D &(*node)->next; + do { value =3D find_next_bit(backend->host_nodes, MAX_NODES, value + 1); if (value =3D=3D MAX_NODES) { break; } =20 - node =3D host_memory_append_node(node, value); + *node =3D g_malloc0(sizeof(**node)); + (*node)->value =3D value; + node =3D &(*node)->next; } while (true); =20 -out: visit_type_uint16List(v, name, &host_nodes, errp); } =20 --=20 2.7.4 From nobody Tue Apr 30 07:54:19 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 1490208298119508.94672106373093; Wed, 22 Mar 2017 11:44:58 -0700 (PDT) Received: from localhost ([::1]:52826 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqlFg-0007nW-Nz for importer@patchew.org; Wed, 22 Mar 2017 14:44:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41347) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cql7T-0008GU-Qj for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cql7S-0000Zv-47 for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53254) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cql7R-0000YM-SP for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:25 -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 D92A2C04BD4C for ; Wed, 22 Mar 2017 18:36:25 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9F9A67F3A5 for ; Wed, 22 Mar 2017 18:36:25 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 8437B113861D; Wed, 22 Mar 2017 19:36:21 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D92A2C04BD4C Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=armbru@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com D92A2C04BD4C From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 19:36:18 +0100 Message-Id: <1490207781-18965-15-git-send-email-armbru@redhat.com> In-Reply-To: <1490207781-18965-1-git-send-email-armbru@redhat.com> References: <1490207781-18965-1-git-send-email-armbru@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.31]); Wed, 22 Mar 2017 18:36:26 +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] [PULL v3 for-2.9 14/17] test-qobject-input-visitor: Cover visit_type_uint64() 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: , 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" The new test demonstrates known bugs: integers between INT64_MAX+1 and UINT64_MAX rejected, and integers between INT64_MIN and -1 are accepted modulo 2^64. Signed-off-by: Markus Armbruster Message-Id: <1490118290-6133-1-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake --- tests/test-qobject-input-visitor.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/test-qobject-input-visitor.c b/tests/test-qobject-input-= visitor.c index 6eb48fe..f965743 100644 --- a/tests/test-qobject-input-visitor.c +++ b/tests/test-qobject-input-visitor.c @@ -116,6 +116,34 @@ static void test_visitor_in_int(TestInputVisitorData *= data, g_assert_cmpint(res, =3D=3D, value); } =20 +static void test_visitor_in_uint(TestInputVisitorData *data, + const void *unused) +{ + Error *err =3D NULL; + uint64_t res =3D 0; + int value =3D 42; + Visitor *v; + + v =3D visitor_input_test_init(data, "%d", value); + + visit_type_uint64(v, NULL, &res, &error_abort); + g_assert_cmpuint(res, =3D=3D, (uint64_t)value); + + /* BUG: value between INT64_MIN and -1 accepted modulo 2^64 */ + + v =3D visitor_input_test_init(data, "%d", -value); + + visit_type_uint64(v, NULL, &res, &error_abort); + g_assert_cmpuint(res, =3D=3D, (uint64_t)-value); + + /* BUG: value between INT64_MAX+1 and UINT64_MAX rejected */ + + v =3D visitor_input_test_init(data, "18446744073709551574"); + + visit_type_uint64(v, NULL, &res, &err); + error_free_or_abort(&err); +} + static void test_visitor_in_int_overflow(TestInputVisitorData *data, const void *unused) { @@ -1225,6 +1253,8 @@ int main(int argc, char **argv) =20 input_visitor_test_add("/visitor/input/int", NULL, test_visitor_in_int); + input_visitor_test_add("/visitor/input/uint", + NULL, test_visitor_in_uint); input_visitor_test_add("/visitor/input/int_overflow", NULL, test_visitor_in_int_overflow); input_visitor_test_add("/visitor/input/int_keyval", --=20 2.7.4 From nobody Tue Apr 30 07:54:19 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 1490208032331827.1644025477443; Wed, 22 Mar 2017 11:40:32 -0700 (PDT) Received: from localhost ([::1]:52811 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqlBO-0003bp-Tj for importer@patchew.org; Wed, 22 Mar 2017 14:40:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41430) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cql7V-0008HF-6C for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cql7T-0000au-IY for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34906) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cql7T-0000ac-DV; Wed, 22 Mar 2017 14:36:27 -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 713E942BD8; Wed, 22 Mar 2017 18:36:27 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F3597868AB; Wed, 22 Mar 2017 18:36:26 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 8714111384C4; Wed, 22 Mar 2017 19:36:21 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 713E942BD8 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=armbru@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 713E942BD8 From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 19:36:19 +0100 Message-Id: <1490207781-18965-16-git-send-email-armbru@redhat.com> In-Reply-To: <1490207781-18965-1-git-send-email-armbru@redhat.com> References: <1490207781-18965-1-git-send-email-armbru@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.30]); Wed, 22 Mar 2017 18:36:27 +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] [PULL v3 for-2.9 15/17] tests: Expose regression in QemuOpts visitor 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: qemu-stable@nongnu.org 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" From: Eric Blake Commit 15c2f669e broke the ability of the QemuOpts visitor to flag extra input parameters, but the regression went unnoticed because of missing testsuite coverage. Add a test to cover this; take the approach already used in 9cb8ef3 of adding a test that passes (to avoid breaking bisection) but marks with BUG the behavior that we don't like, so that the actual impact of the fix in a later patch is easier to see. CC: qemu-stable@nongnu.org Signed-off-by: Eric Blake Reviewed-by: Michael Roth Message-Id: <20170322144525.18964-2-eblake@redhat.com> Reviewed-by: Markus Armbruster Signed-off-by: Markus Armbruster --- tests/test-opts-visitor.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/test-opts-visitor.c b/tests/test-opts-visitor.c index 2238f8e..8e0dda5 100644 --- a/tests/test-opts-visitor.c +++ b/tests/test-opts-visitor.c @@ -247,6 +247,24 @@ test_opts_range_beyond(void) qemu_opts_del(opts); } =20 +static void +test_opts_dict_unvisited(void) +{ + QemuOpts *opts; + Visitor *v; + UserDefOptions *userdef; + + opts =3D qemu_opts_parse(qemu_find_opts("userdef"), "i64x=3D0,bogus=3D= 1", false, + &error_abort); + + v =3D opts_visitor_new(opts); + /* BUG: bogus should be diagnosed */ + visit_type_UserDefOptions(v, NULL, &userdef, &error_abort); + visit_free(v); + qemu_opts_del(opts); + qapi_free_UserDefOptions(userdef); +} + int main(int argc, char **argv) { @@ -343,6 +361,8 @@ main(int argc, char **argv) g_test_add_func("/visitor/opts/range/beyond", test_opts_range_beyond); =20 + g_test_add_func("/visitor/opts/dict/unvisited", test_opts_dict_unvisit= ed); + g_test_run(); return 0; } --=20 2.7.4 From nobody Tue Apr 30 07:54:19 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 1490208170959751.8644431980895; Wed, 22 Mar 2017 11:42:50 -0700 (PDT) Received: from localhost ([::1]:52818 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqlDd-0005lX-L7 for importer@patchew.org; Wed, 22 Mar 2017 14:42:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41496) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cql7X-0008JC-24 for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cql7U-0000cr-UB for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53318) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cql7U-0000c8-JU; Wed, 22 Mar 2017 14:36:28 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7CC19C012844; Wed, 22 Mar 2017 18:36:28 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 00B597EFE3; Wed, 22 Mar 2017 18:36:26 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 89EF71133006; Wed, 22 Mar 2017 19:36:21 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7CC19C012844 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=armbru@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 7CC19C012844 From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 19:36:20 +0100 Message-Id: <1490207781-18965-17-git-send-email-armbru@redhat.com> In-Reply-To: <1490207781-18965-1-git-send-email-armbru@redhat.com> References: <1490207781-18965-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 22 Mar 2017 18:36:28 +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] [PULL v3 for-2.9 16/17] qom: Avoid unvisited 'id'/'qom-type' in user_creatable_add_opts 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: qemu-stable@nongnu.org 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" From: Eric Blake A regression in commit 15c2f669e caused us to silently ignore excess input to the QemuOpts visitor. Later, commit ea4641 accidentally abused that situation, by removing "qom-type" and "id" from the corresponding QDict but leaving them defined in the QemuOpts, when using the pair of containers to create a user-defined object. Note that since we are already traversing two separate items (a QDict and a QemuOpts), we are already able to flag bogus arguments, as in: $ ./x86_64-softmmu/qemu-system-x86_64 -nodefaults -nographic -qmp stdio -ob= ject memory-backend-ram,id=3Dmem1,size=3D4k,bogus=3Dhuh qemu-system-x86_64: -object memory-backend-ram,id=3Dmem1,size=3D4k,bogus=3D= huh: Property '.bogus' not found So the only real concern is that when we re-enable strict checking in the QemuOpts visitor, we do not want to start flagging the two leftover keys as unvisited. Rearrange the code to clean out the QemuOpts listing in advance, rather than removing items from the QDict. Since "qom-type" is usually an automatic implicit default, we don't have to restore it (this does mean that once instantiated, QemuOpts is not necessarily an accurate representation of the original command line - but this is not the first place to do that); however "id" has to be put back (requiring us to cast away a const). [As a side note, hmp_object_add() turns a QDict into a QemuOpts, then calls user_creatable_add_opts() which converts QemuOpts into a new QDict. There are probably a lot of wasteful conversions like this, but cleaning them up is a much bigger task than the immediate regression fix.] CC: qemu-stable@nongnu.org Signed-off-by: Eric Blake Message-Id: <20170322144525.18964-3-eblake@redhat.com> Tested-by: Laurent Vivier Reviewed-by: Markus Armbruster Signed-off-by: Markus Armbruster --- qom/object_interfaces.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c index 03a95c3..9c271ad 100644 --- a/qom/object_interfaces.c +++ b/qom/object_interfaces.c @@ -114,7 +114,7 @@ Object *user_creatable_add_opts(QemuOpts *opts, Error *= *errp) QDict *pdict; Object *obj; const char *id =3D qemu_opts_id(opts); - const char *type =3D qemu_opt_get(opts, "qom-type"); + char *type =3D qemu_opt_get_del(opts, "qom-type"); =20 if (!type) { error_setg(errp, QERR_MISSING_PARAMETER, "qom-type"); @@ -122,17 +122,19 @@ Object *user_creatable_add_opts(QemuOpts *opts, Error= **errp) } if (!id) { error_setg(errp, QERR_MISSING_PARAMETER, "id"); + g_free(type); return NULL; } =20 + qemu_opts_set_id(opts, NULL); pdict =3D qemu_opts_to_qdict(opts, NULL); - qdict_del(pdict, "qom-type"); - qdict_del(pdict, "id"); =20 v =3D opts_visitor_new(opts); obj =3D user_creatable_add_type(type, id, pdict, v, errp); visit_free(v); =20 + qemu_opts_set_id(opts, (char *) id); + g_free(type); QDECREF(pdict); return obj; } --=20 2.7.4 From nobody Tue Apr 30 07:54:19 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 1490208359181860.1477290646028; Wed, 22 Mar 2017 11:45:59 -0700 (PDT) Received: from localhost ([::1]:52835 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqlGf-0000HB-U5 for importer@patchew.org; Wed, 22 Mar 2017 14:45:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41494) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cql7W-0008J7-Ti for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cql7U-0000cP-DK for qemu-devel@nongnu.org; Wed, 22 Mar 2017 14:36:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56122) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cql7U-0000ap-3u; Wed, 22 Mar 2017 14:36:28 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F07C280511; Wed, 22 Mar 2017 18:36:27 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 01B2C7EFE4; Wed, 22 Mar 2017 18:36:27 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 8CE301133018; Wed, 22 Mar 2017 19:36:21 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com F07C280511 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=armbru@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com F07C280511 From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 19:36:21 +0100 Message-Id: <1490207781-18965-18-git-send-email-armbru@redhat.com> In-Reply-To: <1490207781-18965-1-git-send-email-armbru@redhat.com> References: <1490207781-18965-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 22 Mar 2017 18:36:28 +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] [PULL v3 for-2.9 17/17] qapi: Fix QemuOpts visitor regression on unvisited input 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: qemu-stable@nongnu.org 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" From: Eric Blake An off-by-one in commit 15c2f669e meant that we were failing to check for unparsed input in all QemuOpts visitors. Recent testsuite additions show that fixing the obvious bug with bogus fields will also fix the case of an incomplete list visit; update the tests to match the new behavior. Simple testcase: ./x86_64-softmmu/qemu-system-x86_64 -nodefaults -nographic -qmp stdio -numa= node,size=3D1g failed to diagnose that 'size' is not a valid argument to -numa, and now once again reports: qemu-system-x86_64: -numa node,size=3D1g: Invalid parameter 'size' See also https://bugzilla.redhat.com/show_bug.cgi?id=3D1434666 CC: qemu-stable@nongnu.org Signed-off-by: Eric Blake Reviewed-by: Michael Roth Tested-by: Laurent Vivier Message-Id: <20170322144525.18964-4-eblake@redhat.com> Reviewed-by: Markus Armbruster Signed-off-by: Markus Armbruster --- qapi/opts-visitor.c | 6 +++--- tests/test-opts-visitor.c | 13 ++++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/qapi/opts-visitor.c b/qapi/opts-visitor.c index 026d25b..324b197 100644 --- a/qapi/opts-visitor.c +++ b/qapi/opts-visitor.c @@ -164,7 +164,7 @@ opts_check_struct(Visitor *v, Error **errp) GHashTableIter iter; GQueue *any; =20 - if (ov->depth > 0) { + if (ov->depth > 1) { return; } =20 @@ -276,8 +276,8 @@ static void opts_check_list(Visitor *v, Error **errp) { /* - * FIXME should set error when unvisited elements remain. Mostly - * harmless, as the generated visits always visit all elements. + * Unvisited list elements will be reported later when checking + * whether unvisited struct members remain. */ } =20 diff --git a/tests/test-opts-visitor.c b/tests/test-opts-visitor.c index 8e0dda5..23e8970 100644 --- a/tests/test-opts-visitor.c +++ b/tests/test-opts-visitor.c @@ -175,6 +175,7 @@ expect_u64_max(OptsVisitorFixture *f, gconstpointer tes= t_data) static void test_opts_range_unvisited(void) { + Error *err =3D NULL; intList *list =3D NULL; intList *tail; QemuOpts *opts; @@ -199,10 +200,11 @@ test_opts_range_unvisited(void) g_assert_cmpint(tail->value, =3D=3D, 1); tail =3D (intList *)visit_next_list(v, (GenericList *)tail, sizeof(*li= st)); g_assert(tail); - visit_check_list(v, &error_abort); /* BUG: unvisited tail not reported= */ + visit_check_list(v, &error_abort); /* unvisited tail ignored until... = */ visit_end_list(v, (void **)&list); =20 - visit_check_struct(v, &error_abort); + visit_check_struct(v, &err); /* ...here */ + error_free_or_abort(&err); visit_end_struct(v, NULL); =20 qapi_free_intList(list); @@ -250,6 +252,7 @@ test_opts_range_beyond(void) static void test_opts_dict_unvisited(void) { + Error *err =3D NULL; QemuOpts *opts; Visitor *v; UserDefOptions *userdef; @@ -258,11 +261,11 @@ test_opts_dict_unvisited(void) &error_abort); =20 v =3D opts_visitor_new(opts); - /* BUG: bogus should be diagnosed */ - visit_type_UserDefOptions(v, NULL, &userdef, &error_abort); + visit_type_UserDefOptions(v, NULL, &userdef, &err); + error_free_or_abort(&err); visit_free(v); qemu_opts_del(opts); - qapi_free_UserDefOptions(userdef); + g_assert(!userdef); } =20 int --=20 2.7.4