From nobody Mon May 6 11:31:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1571916350; cv=none; d=zoho.com; s=zohoarc; b=lc7a/UU63Pt8EqA82yRE6MD4XoOt3GJJ3V9q1SLvJ9QfNHhGRrCVco0I4opP4NQ9L5kffTCbR0fouFOMtTL0XQ/qXH40JahBoDoQ1CM7NyU83fD/4dhit5l93d/jVupopJJoW9gsn+PtEDSC2Bz26ssdPvf4lgXCgHzJ0D4lEZ4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571916350; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=lp9FhpPqPeW4kPws4YpI5d1qIzH6KB4ie+B1xHi7htA=; b=Arq8HvXe4+oz30D4dg9y+/hTjcyxqGugTurnPAMN5ehuIk38tmpIiL9ST9zGZ5ytMEJ8qNQHUEGmAG1jnf6E5un6HwSE32gVR3OdMbZkpRwpdpgTIHZ6VKZqZv0rxGmDRAv+oLHr6lytKJvbm5OiHUUDgCKDKyQMTlTJkcScEBo= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1571916350850830.9767249401837; Thu, 24 Oct 2019 04:25:50 -0700 (PDT) Received: from localhost ([::1]:38894 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNawH-0003sX-DV for importer@patchew.org; Thu, 24 Oct 2019 07:05:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59155) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNatE-0000oR-7X for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNatC-0004oN-6O for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:48 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:27434 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iNatB-0004kK-QJ for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:46 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-310-u0xY2OtINme5AWY6k0hlcQ-1; Thu, 24 Oct 2019 07:02:40 -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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id DD67780183E; Thu, 24 Oct 2019 11:02:39 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BC7356061E; Thu, 24 Oct 2019 11:02:38 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 3598A11384A8; Thu, 24 Oct 2019 13:02:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571914962; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lp9FhpPqPeW4kPws4YpI5d1qIzH6KB4ie+B1xHi7htA=; b=CW/5RUHmmtqOOScrxfoW9sTy0iU5hNqmedoqS/8Gf9WgC8mDa28DdlfPcDrMmjVo7QbudS jTaOwGyVeLQPetFiy3pfZJIQNpZ6Utn4tOosPbGcGJb9v3tm17Cr2kefzX2OB8YI6OD/Pm OEgXNZy502PZFWRLgt7eMfIs82Qiai4= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 01/19] tests/qapi-schema: Demonstrate feature and enum doc comment bugs Date: Thu, 24 Oct 2019 13:02:19 +0200 Message-Id: <20191024110237.30963-2-armbru@redhat.com> In-Reply-To: <20191024110237.30963-1-armbru@redhat.com> References: <20191024110237.30963-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: u0xY2OtINme5AWY6k0hlcQ-1 X-Mimecast-Spam-Score: 0 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: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, pkrempa@redhat.com, mdroth@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Add negative tests doc-bad-enum-member and doc-bad-feature to cover documentation for nonexistent enum members and features, and test doc-undoc-feature to cover features lacking documentation. None of them works. To be fixed later in this series. Signed-off-by: Markus Armbruster --- tests/Makefile.include | 3 +++ tests/qapi-schema/doc-bad-enum-member.err | 0 tests/qapi-schema/doc-bad-enum-member.json | 9 +++++++++ tests/qapi-schema/doc-bad-enum-member.out | 21 +++++++++++++++++++++ tests/qapi-schema/doc-bad-feature.err | 0 tests/qapi-schema/doc-bad-feature.json | 10 ++++++++++ tests/qapi-schema/doc-bad-feature.out | 17 +++++++++++++++++ tests/qapi-schema/doc-undoc-feature.err | 0 tests/qapi-schema/doc-undoc-feature.json | 10 ++++++++++ tests/qapi-schema/doc-undoc-feature.out | 19 +++++++++++++++++++ 10 files changed, 89 insertions(+) create mode 100644 tests/qapi-schema/doc-bad-enum-member.err create mode 100644 tests/qapi-schema/doc-bad-enum-member.json create mode 100644 tests/qapi-schema/doc-bad-enum-member.out create mode 100644 tests/qapi-schema/doc-bad-feature.err create mode 100644 tests/qapi-schema/doc-bad-feature.json create mode 100644 tests/qapi-schema/doc-bad-feature.out create mode 100644 tests/qapi-schema/doc-undoc-feature.err create mode 100644 tests/qapi-schema/doc-undoc-feature.json create mode 100644 tests/qapi-schema/doc-undoc-feature.out diff --git a/tests/Makefile.include b/tests/Makefile.include index 09e5b410dc..b9deb131fb 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -342,6 +342,8 @@ qapi-schema +=3D command-int.json qapi-schema +=3D comments.json qapi-schema +=3D doc-bad-alternate-member.json qapi-schema +=3D doc-bad-command-arg.json +qapi-schema +=3D doc-bad-enum-member.json +qapi-schema +=3D doc-bad-feature.json qapi-schema +=3D doc-bad-section.json qapi-schema +=3D doc-bad-symbol.json qapi-schema +=3D doc-bad-union-member.json @@ -365,6 +367,7 @@ qapi-schema +=3D doc-missing-expr.json qapi-schema +=3D doc-missing-space.json qapi-schema +=3D doc-missing.json qapi-schema +=3D doc-no-symbol.json +qapi-schema +=3D doc-undoc-feature.json qapi-schema +=3D double-type.json qapi-schema +=3D duplicate-key.json qapi-schema +=3D empty.json diff --git a/tests/qapi-schema/doc-bad-enum-member.err b/tests/qapi-schema/= doc-bad-enum-member.err new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/qapi-schema/doc-bad-enum-member.json b/tests/qapi-schema= /doc-bad-enum-member.json new file mode 100644 index 0000000000..9f32fe64b4 --- /dev/null +++ b/tests/qapi-schema/doc-bad-enum-member.json @@ -0,0 +1,9 @@ +# Members listed in the doc comment must exist in the actual schema +# BUG: nonexistent @a is not rejected + +## +# @Foo: +# @a: a +# @b: b +## +{ 'enum': 'Foo', 'data': [ 'b' ] } diff --git a/tests/qapi-schema/doc-bad-enum-member.out b/tests/qapi-schema/= doc-bad-enum-member.out new file mode 100644 index 0000000000..6ca31c1e9b --- /dev/null +++ b/tests/qapi-schema/doc-bad-enum-member.out @@ -0,0 +1,21 @@ +module None +object q_empty +enum QType + prefix QTYPE + member none + member qnull + member qnum + member qstring + member qdict + member qlist + member qbool +module doc-bad-enum-member.json +enum Foo + member b +doc symbol=3DFoo + body=3D + + arg=3Da +a + arg=3Db +b diff --git a/tests/qapi-schema/doc-bad-feature.err b/tests/qapi-schema/doc-= bad-feature.err new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/qapi-schema/doc-bad-feature.json b/tests/qapi-schema/doc= -bad-feature.json new file mode 100644 index 0000000000..2a78e3b1db --- /dev/null +++ b/tests/qapi-schema/doc-bad-feature.json @@ -0,0 +1,10 @@ +# Features listed in the doc comment must exist in the actual schema +# BUG: nonexistent @a is not rejected + +## +# @foo: +# +# Features: +# @a: a +## +{ 'command': 'foo' } diff --git a/tests/qapi-schema/doc-bad-feature.out b/tests/qapi-schema/doc-= bad-feature.out new file mode 100644 index 0000000000..4670be3a72 --- /dev/null +++ b/tests/qapi-schema/doc-bad-feature.out @@ -0,0 +1,17 @@ +module None +object q_empty +enum QType + prefix QTYPE + member none + member qnull + member qnum + member qstring + member qdict + member qlist + member qbool +module doc-bad-feature.json +command foo None -> None + gen=3DTrue success_response=3DTrue boxed=3DFalse oob=3DFalse preconfig= =3DFalse +doc symbol=3Dfoo + body=3D + diff --git a/tests/qapi-schema/doc-undoc-feature.err b/tests/qapi-schema/do= c-undoc-feature.err new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/qapi-schema/doc-undoc-feature.json b/tests/qapi-schema/d= oc-undoc-feature.json new file mode 100644 index 0000000000..c7650d9974 --- /dev/null +++ b/tests/qapi-schema/doc-undoc-feature.json @@ -0,0 +1,10 @@ +# Doc comment must cover all features +# BUG: missing documentation for @undoc not caught + +## +# @foo: +# +# Features: +# @doc: documented feature +## +{ 'command': 'foo', 'features': ['undoc', 'doc'] } diff --git a/tests/qapi-schema/doc-undoc-feature.out b/tests/qapi-schema/do= c-undoc-feature.out new file mode 100644 index 0000000000..faae777f0d --- /dev/null +++ b/tests/qapi-schema/doc-undoc-feature.out @@ -0,0 +1,19 @@ +module None +object q_empty +enum QType + prefix QTYPE + member none + member qnull + member qnum + member qstring + member qdict + member qlist + member qbool +module doc-undoc-feature.json +command foo None -> None + gen=3DTrue success_response=3DTrue boxed=3DFalse oob=3DFalse preconfig= =3DFalse + feature undoc + feature doc +doc symbol=3Dfoo + body=3D + --=20 2.21.0 From nobody Mon May 6 11:31:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1571916119; cv=none; d=zoho.com; s=zohoarc; b=StNFmbRVRxBJFjDJikQLuolsn+1DWzwLK0um8or5eUsiCNN+R0xcsIEbiSypvpduULrXveb+kibHVeYtbYvryvPD8ifOQyXe9DrvFRVe9GevhemtIyWUQD3zH5sVDfX2csXb2RIjBYdoeMXl03SKwKwwsbFFQS6HsEhbhUctupk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571916119; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nY8sPXoPv6bdDgTv7e288AmKHTGhWVNKQpDom+3IaZY=; b=avHC0NXAZk3OCog1wFaTc0noMxSyU/JyaR2NTs8sf+8DI/FLnx3vpZACmYWVaLjfEer6MgyTiHWrcTWUa/yGt/Gai15UQxqxF/JxmuF7c2xFeuLS3VmLUX7NfJPgIZ9SBz9OnsXVwsmSmNfwjLDSm0eRTVNw0Lby24fNcDzLvSo= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1571916119656168.6643860629414; Thu, 24 Oct 2019 04:21:59 -0700 (PDT) Received: from localhost ([::1]:39754 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNbBl-0003bE-Vf for importer@patchew.org; Thu, 24 Oct 2019 07:21:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59319) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNatJ-0000xt-Ty for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNatE-0004p4-4R for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:53 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:48325 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iNatC-0004kj-5J for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:46 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-132-s4gOj8gXOlOOFkIFUjxISA-1; Thu, 24 Oct 2019 07:02:40 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2F63A1005500; Thu, 24 Oct 2019 11:02:39 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C01AF196B2; Thu, 24 Oct 2019 11:02:38 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 3E7D51133034; Thu, 24 Oct 2019 13:02:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571914963; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nY8sPXoPv6bdDgTv7e288AmKHTGhWVNKQpDom+3IaZY=; b=N9aw4x0p2jEL7g1kbgEpai57U5mQRRJzpdF/O7g7W1QFWIGpKyC2z5+Zfokkjg2OeZaDUj msJqM8EgV+rQgSNZ/vM1uWPzD9U2iptuZDdzbRE5SIIGd8Xbywh3dhllT+Ftyld4xioAJA aKRNyYd4yb36sYk1IhEzyKUUhahIHxA= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 02/19] tests/qapi-schema: Demonstrate command and event doc comment bugs Date: Thu, 24 Oct 2019 13:02:20 +0200 Message-Id: <20191024110237.30963-3-armbru@redhat.com> In-Reply-To: <20191024110237.30963-1-armbru@redhat.com> References: <20191024110237.30963-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: s4gOj8gXOlOOFkIFUjxISA-1 X-Mimecast-Spam-Score: 0 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: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, pkrempa@redhat.com, mdroth@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Add negative tests doc-bad-boxed-command-arg and doc-bad-event-arg to cover boxed and no arguments. They demonstrate insufficient doc comment checking. Update positive test doc-good to cover boxed event arguments. It demonstrates the generated doc comment misses arguments. These bugs will be fixed later in this series. Signed-off-by: Markus Armbruster --- tests/qapi-schema/doc-good.texi | 8 ++++++ tests/Makefile.include | 2 ++ .../qapi-schema/doc-bad-boxed-command-arg.err | 0 .../doc-bad-boxed-command-arg.json | 15 +++++++++++ .../qapi-schema/doc-bad-boxed-command-arg.out | 26 +++++++++++++++++++ tests/qapi-schema/doc-bad-event-arg.err | 0 tests/qapi-schema/doc-bad-event-arg.json | 8 ++++++ tests/qapi-schema/doc-bad-event-arg.out | 19 ++++++++++++++ tests/qapi-schema/doc-good.json | 7 +++++ tests/qapi-schema/doc-good.out | 5 ++++ 10 files changed, 90 insertions(+) create mode 100644 tests/qapi-schema/doc-bad-boxed-command-arg.err create mode 100644 tests/qapi-schema/doc-bad-boxed-command-arg.json create mode 100644 tests/qapi-schema/doc-bad-boxed-command-arg.out create mode 100644 tests/qapi-schema/doc-bad-event-arg.err create mode 100644 tests/qapi-schema/doc-bad-event-arg.json create mode 100644 tests/qapi-schema/doc-bad-event-arg.out diff --git a/tests/qapi-schema/doc-good.texi b/tests/qapi-schema/doc-good.t= exi index 2ce8b883c9..d6ecdac94f 100644 --- a/tests/qapi-schema/doc-good.texi +++ b/tests/qapi-schema/doc-good.texi @@ -258,3 +258,11 @@ another feature =20 @end deftypefn =20 + + +@deftypefn Event {} EVT-BOXED + +BUG: generated doc misses arguments + +@end deftypefn + diff --git a/tests/Makefile.include b/tests/Makefile.include index b9deb131fb..ea35cd54cc 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -341,8 +341,10 @@ qapi-schema +=3D base-cycle-indirect.json qapi-schema +=3D command-int.json qapi-schema +=3D comments.json qapi-schema +=3D doc-bad-alternate-member.json +qapi-schema +=3D doc-bad-boxed-command-arg.json qapi-schema +=3D doc-bad-command-arg.json qapi-schema +=3D doc-bad-enum-member.json +qapi-schema +=3D doc-bad-event-arg.json qapi-schema +=3D doc-bad-feature.json qapi-schema +=3D doc-bad-section.json qapi-schema +=3D doc-bad-symbol.json diff --git a/tests/qapi-schema/doc-bad-boxed-command-arg.err b/tests/qapi-s= chema/doc-bad-boxed-command-arg.err new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/qapi-schema/doc-bad-boxed-command-arg.json b/tests/qapi-= schema/doc-bad-boxed-command-arg.json new file mode 100644 index 0000000000..2c265d2ca3 --- /dev/null +++ b/tests/qapi-schema/doc-bad-boxed-command-arg.json @@ -0,0 +1,15 @@ +# Boxed arguments are not to be documented with the command +# BUG: not rejected + +## +# @Args: +# @a: an argument +## +{ 'struct': 'Args', 'data': { 'a': 'int' } } + +## +# @cmd-boxed: +# @a: bogus +## +{ 'command': 'cmd-boxed', 'boxed': true, + 'data': 'Args' } diff --git a/tests/qapi-schema/doc-bad-boxed-command-arg.out b/tests/qapi-s= chema/doc-bad-boxed-command-arg.out new file mode 100644 index 0000000000..4ccd788253 --- /dev/null +++ b/tests/qapi-schema/doc-bad-boxed-command-arg.out @@ -0,0 +1,26 @@ +module None +object q_empty +enum QType + prefix QTYPE + member none + member qnull + member qnum + member qstring + member qdict + member qlist + member qbool +module doc-bad-boxed-command-arg.json +object Args + member a: int optional=3DFalse +command cmd-boxed Args -> None + gen=3DTrue success_response=3DTrue boxed=3DTrue oob=3DFalse preconfig= =3DFalse +doc symbol=3DArgs + body=3D + + arg=3Da +an argument +doc symbol=3Dcmd-boxed + body=3D + + arg=3Da +bogus diff --git a/tests/qapi-schema/doc-bad-event-arg.err b/tests/qapi-schema/do= c-bad-event-arg.err new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/qapi-schema/doc-bad-event-arg.json b/tests/qapi-schema/d= oc-bad-event-arg.json new file mode 100644 index 0000000000..80d4e1240b --- /dev/null +++ b/tests/qapi-schema/doc-bad-event-arg.json @@ -0,0 +1,8 @@ +# Arguments listed in the doc comment must exist in the actual schema +# BUG: nonexistent @a is not rejected + +## +# @FOO: +# @a: a +## +{ 'event': 'FOO' } diff --git a/tests/qapi-schema/doc-bad-event-arg.out b/tests/qapi-schema/do= c-bad-event-arg.out new file mode 100644 index 0000000000..ad0367cd45 --- /dev/null +++ b/tests/qapi-schema/doc-bad-event-arg.out @@ -0,0 +1,19 @@ +module None +object q_empty +enum QType + prefix QTYPE + member none + member qnull + member qnum + member qstring + member qdict + member qlist + member qbool +module doc-bad-event-arg.json +event FOO None + boxed=3DFalse +doc symbol=3DFOO + body=3D + + arg=3Da +a diff --git a/tests/qapi-schema/doc-good.json b/tests/qapi-schema/doc-good.j= son index 7dc21e58a3..1ae6c3a9da 100644 --- a/tests/qapi-schema/doc-good.json +++ b/tests/qapi-schema/doc-good.json @@ -149,3 +149,10 @@ { 'command': 'cmd-boxed', 'boxed': true, 'data': 'Object', 'features': [ 'cmd-feat1', 'cmd-feat2' ] } + +## +# @EVT-BOXED: +# BUG: generated doc misses arguments +## +{ 'event': 'EVT-BOXED', 'boxed': true, + 'data': 'Object' } diff --git a/tests/qapi-schema/doc-good.out b/tests/qapi-schema/doc-good.out index f78fdef6a9..a8fc39d288 100644 --- a/tests/qapi-schema/doc-good.out +++ b/tests/qapi-schema/doc-good.out @@ -54,6 +54,8 @@ command cmd-boxed Object -> None gen=3DTrue success_response=3DTrue boxed=3DTrue oob=3DFalse preconfig= =3DFalse feature cmd-feat1 feature cmd-feat2 +event EVT-BOXED Object + boxed=3DTrue doc freeform body=3D =3D Section @@ -170,3 +172,6 @@ If you're bored enough to read this, go see a video of = boxed cats -> in =20 <- out +doc symbol=3DEVT-BOXED + body=3D +BUG: generated doc misses arguments --=20 2.21.0 From nobody Mon May 6 11:31:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1571916410; cv=none; d=zoho.com; s=zohoarc; b=MzFbXoi5+k5s/He2VKT3hH4d6kj1+YK/jgOePDG8PtP4wWIUuFD91P/g1g5sdNRhKIduNX3ODaUHEkN8ZUQP/qk8TnCgo5seQxOA55UwFG2ZPYK4ZZKLSz1PE2xmJgb0o38tbrnHv4zrH2F1/ZSQvKACVy75N7ldw7oQ0Zm4GS8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571916410; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=fxh12PF2cAkgZjSZruCPbNHHQBZtA9Wr9tzr5cDv73c=; b=C+dOboYECGoaUI5e/gCIQlFW4TPzi8SgovTYOWyk1SVjZ0lmvh8mB6Cnj/XC6/VbpOqXM9BgSx1M3O91CB3bqJ9ny0xEx3CHiAyd7VF/GyNSJ2SP0wnSjzOPBgGe9Htk/iqmhKXHDkuOpYZpENR7EAzra8wPll/HNuyPrBYrGNI= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1571916410339913.495178081991; Thu, 24 Oct 2019 04:26:50 -0700 (PDT) Received: from localhost ([::1]:38984 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNb3T-0002MH-Cr for importer@patchew.org; Thu, 24 Oct 2019 07:13:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59314) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNatK-0000xo-2Y for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNatE-0004pO-67 for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:53 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:20710 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iNatC-0004le-7U for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:48 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-42-iilQuN2LP_m9y6UiNhJ7Ug-1; Thu, 24 Oct 2019 07:02:41 -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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id DF427801E5F; Thu, 24 Oct 2019 11:02:40 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C452460C57; Thu, 24 Oct 2019 11:02:38 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 420AD1132D6D; Thu, 24 Oct 2019 13:02:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571914963; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fxh12PF2cAkgZjSZruCPbNHHQBZtA9Wr9tzr5cDv73c=; b=IqeB74A1+LpvuGIM87K3iNyid2Y5dBgVPaRfgMkLO3nuh4fP9MdRhDDUitMhBw9NPQPxAh Js1zADBpkFL9jwb44U3hDpXNwffwuAC1gYdIUDkVHo87xstdlD3p//P8DfvCpVDYadvsVO 9LdDthclPWK9xQ0VoDZOrTKFu/gnP8A= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 03/19] tests/qapi-schema: Cover alternate documentation comments Date: Thu, 24 Oct 2019 13:02:21 +0200 Message-Id: <20191024110237.30963-4-armbru@redhat.com> In-Reply-To: <20191024110237.30963-1-armbru@redhat.com> References: <20191024110237.30963-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: iilQuN2LP_m9y6UiNhJ7Ug-1 X-Mimecast-Spam-Score: 0 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: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, pkrempa@redhat.com, mdroth@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Markus Armbruster --- tests/qapi-schema/doc-good.texi | 17 +++++++++++++++++ tests/qapi-schema/doc-good.json | 8 ++++++++ tests/qapi-schema/doc-good.out | 12 ++++++++++++ 3 files changed, 37 insertions(+) diff --git a/tests/qapi-schema/doc-good.texi b/tests/qapi-schema/doc-good.t= exi index d6ecdac94f..98aa78e1fb 100644 --- a/tests/qapi-schema/doc-good.texi +++ b/tests/qapi-schema/doc-good.texi @@ -170,6 +170,23 @@ One of @t{"one"}, @t{"two"} @end deftp =20 =20 + +@deftp {Alternate} Alternate + + + +@b{Members:} +@table @asis +@item @code{i: int} +an integer +@code{b} is undocumented +@item @code{b: boolean} +Not documented +@end table + +@end deftp + + @subsection Another subsection =20 =20 diff --git a/tests/qapi-schema/doc-good.json b/tests/qapi-schema/doc-good.j= son index 1ae6c3a9da..df50a877e3 100644 --- a/tests/qapi-schema/doc-good.json +++ b/tests/qapi-schema/doc-good.json @@ -98,6 +98,14 @@ { 'union': 'SugaredUnion', 'data': { 'one': 'Variant1', 'two': { 'type': 'Variant2', 'if': 'IFTWO' = } } } =20 +## +# @Alternate: +# @i: an integer +# @b is undocumented +## +{ 'alternate': 'Alternate', + 'data': { 'i': 'int', 'b': 'bool' } } + ## # =3D=3D Another subsection ## diff --git a/tests/qapi-schema/doc-good.out b/tests/qapi-schema/doc-good.out index a8fc39d288..b0e99f2110 100644 --- a/tests/qapi-schema/doc-good.out +++ b/tests/qapi-schema/doc-good.out @@ -42,6 +42,10 @@ object SugaredUnion case one: q_obj_Variant1-wrapper case two: q_obj_Variant2-wrapper if ['IFTWO'] +alternate Alternate + tag type + case i: int + case b: bool object q_obj_cmd-arg member arg1: int optional=3DFalse member arg2: str optional=3DTrue @@ -133,6 +137,14 @@ doc symbol=3DSugaredUnion =20 arg=3Dtype =20 +doc symbol=3DAlternate + body=3D + + arg=3Di +an integer +@b is undocumented + arg=3Db + doc freeform body=3D =3D=3D Another subsection --=20 2.21.0 From nobody Mon May 6 11:31:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1571919760; cv=none; d=zoho.com; s=zohoarc; b=VfVj0MNkIDzdvR3ZplngTDeeHC41EYjvhocLthebBcCibqnb0IcUxf22KTZxidjN0F9dby2pjGIIJk6I54XApavbXEB32njYgpZvvojU7L9JZ31EzEz2p9VGmYXTAgUpYnQzc/BFSkLVdzgGKmYC1vhFIbVYcYggnRlfq1N0M0s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571919760; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=gc72DB3ktvCd+EH3FWWbD4YDmcljHhXyoV+5dXesYzQ=; b=BvVzLXvuPMsbETXEP855fF1gt1etS3Lco/FBBhNTtRV4ehT7IC7NHi98oh6jqPTde9T9EgRkkN+OSTAepptvW3QHDDVSLV9Jr/03x2tPGKTQBbtbRXJtb5IPS4DcHv47EDhruyKKo+n4HBCe6HU82PnrFjA41ZLv56XYK1ehHtQ= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1571919760444793.5660155222653; Thu, 24 Oct 2019 05:22:40 -0700 (PDT) Received: from localhost ([::1]:40962 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNc8U-0006ui-M6 for importer@patchew.org; Thu, 24 Oct 2019 08:22:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59318) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNatJ-0000xs-SL for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNatE-0004pz-Cb for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:53 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:48566 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iNatE-0004mM-5O for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:48 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-64-wmMy2xy-PDCyM_DXA99Jzw-1; Thu, 24 Oct 2019 07:02:41 -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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2C2D2800D4C; Thu, 24 Oct 2019 11:02:40 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C758760624; Thu, 24 Oct 2019 11:02:38 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 4560F1132A05; Thu, 24 Oct 2019 13:02:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571914964; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gc72DB3ktvCd+EH3FWWbD4YDmcljHhXyoV+5dXesYzQ=; b=PgwrojAk5bR8THfgyNSf0qFPJ3XOIiI2mwzaRgAJkWsKV+J1mZMwGApLuMrmd24Q4XFHDd AqSsXkgXJmBCyQzhMxfJ8RkR63Sc9UaOKzzhrdAjtiHV+a8Iki9WavCPRe2TX/AX6JRHyr tgtmZWPmGoVuo0y0mCXe3awTkKBez7Q= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 04/19] tests/qapi-schema: Fix feature documentation testing Date: Thu, 24 Oct 2019 13:02:22 +0200 Message-Id: <20191024110237.30963-5-armbru@redhat.com> In-Reply-To: <20191024110237.30963-1-armbru@redhat.com> References: <20191024110237.30963-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: wmMy2xy-PDCyM_DXA99Jzw-1 X-Mimecast-Spam-Score: 0 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: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, pkrempa@redhat.com, mdroth@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Commit 8aa3a33e44 "tests/qapi-schema: Test for good feature lists in structs" made test-qapi.py show features, but neglected to show their documentation. Fix that. Signed-off-by: Markus Armbruster --- tests/qapi-schema/doc-bad-feature.out | 2 ++ tests/qapi-schema/doc-good.out | 10 ++++++++++ tests/qapi-schema/doc-undoc-feature.out | 2 ++ tests/qapi-schema/test-qapi.py | 2 ++ 4 files changed, 16 insertions(+) diff --git a/tests/qapi-schema/doc-bad-feature.out b/tests/qapi-schema/doc-= bad-feature.out index 4670be3a72..fef4a3e400 100644 --- a/tests/qapi-schema/doc-bad-feature.out +++ b/tests/qapi-schema/doc-bad-feature.out @@ -15,3 +15,5 @@ command foo None -> None doc symbol=3Dfoo body=3D =20 + feature=3Da +a diff --git a/tests/qapi-schema/doc-good.out b/tests/qapi-schema/doc-good.out index b0e99f2110..8cc29fce50 100644 --- a/tests/qapi-schema/doc-good.out +++ b/tests/qapi-schema/doc-good.out @@ -126,6 +126,8 @@ A paragraph Another paragraph (but no @var: line) arg=3Dvar1 =20 + feature=3Dvariant1-feat +a feature doc symbol=3DVariant2 body=3D =20 @@ -158,6 +160,10 @@ the second argument arg=3Darg3 =20 + feature=3Dcmd-feat1 +a feature + feature=3Dcmd-feat2 +another feature section=3DNote @arg3 is undocumented section=3DReturns @@ -180,6 +186,10 @@ Duis aute irure dolor doc symbol=3Dcmd-boxed body=3D If you're bored enough to read this, go see a video of boxed cats + feature=3Dcmd-feat1 +a feature + feature=3Dcmd-feat2 +another feature section=3DExample -> in =20 diff --git a/tests/qapi-schema/doc-undoc-feature.out b/tests/qapi-schema/do= c-undoc-feature.out index faae777f0d..cdb097361f 100644 --- a/tests/qapi-schema/doc-undoc-feature.out +++ b/tests/qapi-schema/doc-undoc-feature.out @@ -17,3 +17,5 @@ command foo None -> None doc symbol=3Dfoo body=3D =20 + feature=3Ddoc +documented feature diff --git a/tests/qapi-schema/test-qapi.py b/tests/qapi-schema/test-qapi.py index 2bd9fd8742..bad14edb47 100755 --- a/tests/qapi-schema/test-qapi.py +++ b/tests/qapi-schema/test-qapi.py @@ -117,6 +117,8 @@ def test_frontend(fname): print(' body=3D\n%s' % doc.body.text) for arg, section in doc.args.items(): print(' arg=3D%s\n%s' % (arg, section.text)) + for feat, section in doc.features.items(): + print(' feature=3D%s\n%s' % (feat, section.text)) for section in doc.sections: print(' section=3D%s\n%s' % (section.name, section.text)) =20 --=20 2.21.0 From nobody Mon May 6 11:31:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1571916190; cv=none; d=zoho.com; s=zohoarc; b=IUwhdarWVk1lwW+ibW1Ce4Sba4ffdh7OnnzMcIG2TJbqhzmEOquxL7uEEybTlnlq6O4e0qA9wGiXXh3eWjvaVQkj8OsvBYvqeHPA6RzeDMIx4NN4EyeR6O9x3I2BEymhREMhVs+t1sCpNrM8/dTlgH9r78T7QlLz4y2onv+vcDw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571916190; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=HEH6dJqIX2o6eSh9nLq+VexyA00m5Ca/Dv9zvsmSO0o=; b=gIRKiy/RhuIvDHv59c43NvzPV4mZS11Kw5qbnR/A6Enl4zD6/2jLliKMZ3aNozeps0z53tT3k3TW3lPCSZJGCxgs9zLbXixGmq8Y1/V670QCb6HMeRQ/lZCGUOAMJU2P2M9iN3QBrGvfJxoOW+3uoSheg3bBHsU7HNzxxa96d98= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1571916190164168.33363064674074; Thu, 24 Oct 2019 04:23:10 -0700 (PDT) Received: from localhost ([::1]:38898 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNawN-0003xC-DD for importer@patchew.org; Thu, 24 Oct 2019 07:06:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59234) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNatG-0000sW-OG for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNatE-0004pT-6b for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:50 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:30169 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iNatC-0004md-6N for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:48 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-236-KLQ0sS5zOeCkDQ1UCIesKA-1; Thu, 24 Oct 2019 07:02:41 -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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 80BF81005512; Thu, 24 Oct 2019 11:02:40 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4E27360BF3; Thu, 24 Oct 2019 11:02:40 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 489951132A0B; Thu, 24 Oct 2019 13:02:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571914965; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HEH6dJqIX2o6eSh9nLq+VexyA00m5Ca/Dv9zvsmSO0o=; b=SfA6DEcTUyLWrfMVP8eQ0XVfqAEfPcOP4qbmgZCwbzcqQv7dIrc97PCTc5pW6uV34K+so9 6khj0twruinrTUf1i2G+4wYA78he40POeG0ho+bnxu0UVjY/gi60Ndpd2Z3vw9Mr2+YESK KanJvJDW9LjsECQiUMeZv86PxzKHRcA= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 05/19] qemu-doc: Belatedly document QMP command deprecation Date: Thu, 24 Oct 2019 13:02:23 +0200 Message-Id: <20191024110237.30963-6-armbru@redhat.com> In-Reply-To: <20191024110237.30963-1-armbru@redhat.com> References: <20191024110237.30963-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: KLQ0sS5zOeCkDQ1UCIesKA-1 X-Mimecast-Spam-Score: 0 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: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, pkrempa@redhat.com, mdroth@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Commit 24fb413300 "qmp: Introduce blockdev-change-medium" (v2.5.0) deprecated change. Commit 2ff3025797 "migrate: move max-bandwidth and downtime-limit to migrate_set_parameter" (v2.8.0) deprecated migrate_set_downtime and migrate_set_speed. These wre missed in commit eb22aeca65 "docs: document deprecation policy & deprecated features in appendix" (v2.10.0). Commit 73af8dd8d7 "migration: Make xbzrle_cache_size a migration parameter" (v2.11.0) deprecated migrate-set-cache-size and query-migrate-cache-size, but neglected to update qemu-doc. Make up for that. Signed-off-by: Markus Armbruster --- qemu-deprecated.texi | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi index 7239e0959d..f727bd3932 100644 --- a/qemu-deprecated.texi +++ b/qemu-deprecated.texi @@ -149,6 +149,18 @@ QEMU 4.1 has three options, please migrate to one of t= hese three: =20 @section QEMU Machine Protocol (QMP) commands =20 +@subsection change (since 2.5.0) + +Use ``blockdev-change-medium'' or ``change-vnc-password'' instead. + +@subsection migrate_set_downtime and migrate_set_speed (since 2.8.0) + +Use ``migrate-set-parameters'' instead. + +@subsection migrate-set-cache-size and query-migrate-cache-size (since 2.1= 1.0) + +Use ``migrate-set-parameters'' and ``query-migrate-parameters'' instead. + @subsection query-block result field dirty-bitmaps[i].status (since 4.0) =20 The ``status'' field of the ``BlockDirtyInfo'' structure, returned by --=20 2.21.0 From nobody Mon May 6 11:31:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1571916040; cv=none; d=zoho.com; s=zohoarc; b=lvLn0Yxx5KzLUeXHLnWO1ur6mNcFQNVJ60mtlUjtMj6WfMgLkNHzUgBJentXS3rpUfBm534jGPS5rUS2MwAoDschSgEfCBQmshlJtMdnsJ2oDWGft6zueB8T60gvfsq2AvzXQjyJfYCOTKXVne8Sk4KD+xLcw4eBbKrXHYA1m2E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571916040; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=OUZuu+rScb/e+4Yjh+6Cjp8MnfwVLWwWLKBrppf6bhk=; b=jfokau6qDgVhy9OaFjKmFsdCfAqMopP42w3MPnezBUK2dZ43XnwzanCCRQs42xM38e8K9qPa6Y+lrhY9gFx92ROhRCbHeLm9juTfqVM/lxmUUkhNArUHzGoqfDJ6cxWq9MzHSYRa8U7FslTyBF4Ks35tPT3RXohYJK6lJUu5jTo= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15719160400011004.1502316483752; Thu, 24 Oct 2019 04:20:40 -0700 (PDT) Received: from localhost ([::1]:38982 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNb3O-0002DY-1L for importer@patchew.org; Thu, 24 Oct 2019 07:13:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59334) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNatK-0000za-RS for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNatE-0004qr-NE for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:54 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:52275 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iNatE-0004mU-Bh for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:48 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-312-Zdo6mxc_PM2OzVnlnC6dBQ-1; Thu, 24 Oct 2019 07:02:41 -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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 858D41005516; Thu, 24 Oct 2019 11:02:40 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 53174608C1; Thu, 24 Oct 2019 11:02:40 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 4C59411329CF; Thu, 24 Oct 2019 13:02:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571914965; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OUZuu+rScb/e+4Yjh+6Cjp8MnfwVLWwWLKBrppf6bhk=; b=ZdXauqCYSA9eY0G2IP1ky5HgbPbufckqwPuQ9/ZlUeNx0F88BK5zvmU6A3YyElyw/qc3G9 KDixkl1FIdVq4NAKmv4NzEGNZuXK/wAnHKmdtfQf0uXIdmUpBKWdF4ClD51LfTYUvjRylS 5ME+vyTM4WycBeBOCbAkrmdj3U1gACs= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 06/19] qapi: Implement boxed event argument documentation Date: Thu, 24 Oct 2019 13:02:24 +0200 Message-Id: <20191024110237.30963-7-armbru@redhat.com> In-Reply-To: <20191024110237.30963-1-armbru@redhat.com> References: <20191024110237.30963-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: Zdo6mxc_PM2OzVnlnC6dBQ-1 X-Mimecast-Spam-Score: 0 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: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, pkrempa@redhat.com, mdroth@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Generate a reference "Arguments: the members of ...", just like we do for commands since commit c2dd311cb7 "qapi2texi: Implement boxed argument documentation". No change to generated QMP documentation; we don't yet use boxed events outside tests/. Signed-off-by: Markus Armbruster --- tests/qapi-schema/doc-good.texi | 4 +++- scripts/qapi/doc.py | 10 +++++++++- tests/qapi-schema/doc-good.json | 1 - tests/qapi-schema/doc-good.out | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/tests/qapi-schema/doc-good.texi b/tests/qapi-schema/doc-good.t= exi index 98aa78e1fb..d4b15dabf0 100644 --- a/tests/qapi-schema/doc-good.texi +++ b/tests/qapi-schema/doc-good.texi @@ -279,7 +279,9 @@ another feature =20 @deftypefn Event {} EVT-BOXED =20 -BUG: generated doc misses arguments + + +@b{Arguments:} the members of @code{Object} =20 @end deftypefn =20 diff --git a/scripts/qapi/doc.py b/scripts/qapi/doc.py index 6d5726cf6e..f2462c9877 100644 --- a/scripts/qapi/doc.py +++ b/scripts/qapi/doc.py @@ -266,9 +266,17 @@ class QAPISchemaGenDocVisitor(QAPISchemaVisitor): =20 def visit_event(self, name, info, ifcond, arg_type, boxed): doc =3D self.cur_doc + if boxed: + body =3D texi_body(doc) + body +=3D ('\n@b{Arguments:} the members of @code{%s}\n' + % arg_type.name) + body +=3D texi_features(doc) + body +=3D texi_sections(doc, ifcond) + else: + body =3D texi_entity(doc, 'Arguments', ifcond) self._gen.add(MSG_FMT(type=3D'Event', name=3Ddoc.symbol, - body=3Dtexi_entity(doc, 'Arguments', ifcond)= )) + body=3Dbody)) =20 def symbol(self, doc, entity): if self._gen._body: diff --git a/tests/qapi-schema/doc-good.json b/tests/qapi-schema/doc-good.j= son index df50a877e3..d992e713d9 100644 --- a/tests/qapi-schema/doc-good.json +++ b/tests/qapi-schema/doc-good.json @@ -160,7 +160,6 @@ =20 ## # @EVT-BOXED: -# BUG: generated doc misses arguments ## { 'event': 'EVT-BOXED', 'boxed': true, 'data': 'Object' } diff --git a/tests/qapi-schema/doc-good.out b/tests/qapi-schema/doc-good.out index 8cc29fce50..4c9406a464 100644 --- a/tests/qapi-schema/doc-good.out +++ b/tests/qapi-schema/doc-good.out @@ -196,4 +196,4 @@ another feature <- out doc symbol=3DEVT-BOXED body=3D -BUG: generated doc misses arguments + --=20 2.21.0 From nobody Mon May 6 11:31:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1571916419; cv=none; d=zoho.com; s=zohoarc; b=curYJyL83qoRUAZz5cGOaIMMtxgrRGgDrg21tAedTYkIPWA+3xw13k9jZ136Q321vnKL24vMDHfohCZIzwLV4daOBYN6DtEd/Lfs47zbqZZSYfq2FPrBkeh12+6wA22zbB+AdCLwiNUd8kl82Os2t7fkT/yOppTP01vK/JFmzng= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571916419; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=mPYIhZn6+9mdslr9fxABZgfdncQ8mFnhSckQXSTPOew=; b=AUQb6P69F/hVpNxEm65mDv5PisJxv5dX1lZ20FHkmUKc/WhsdrgNyGXdUPhFfBEfcMUn7KPlYSvr3FwFUgnpCs3vNxBTFEuCVG+dE2HerKo9/IdUHWLgIjJz9qVq5upx3uX/JqnTOx/phlJY0t9D44qKZmFYW1PmwRxJydGRcGA= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1571916419686124.38351560534238; Thu, 24 Oct 2019 04:26:59 -0700 (PDT) Received: from localhost ([::1]:39338 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNb7w-0002xF-Lb for importer@patchew.org; Thu, 24 Oct 2019 07:18:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59327) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNatK-0000yk-F7 for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNatI-0004uZ-QM for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:54 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:31475 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iNatI-0004tA-M9 for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:52 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-344-UwY8DTMiNzyV6uNNWHTixA-1; Thu, 24 Oct 2019 07:02:41 -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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id D6E99800D54; Thu, 24 Oct 2019 11:02:40 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 795455C1D4; Thu, 24 Oct 2019 11:02:40 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 5028B1132986; Thu, 24 Oct 2019 13:02:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571914970; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mPYIhZn6+9mdslr9fxABZgfdncQ8mFnhSckQXSTPOew=; b=jB/7zJqhOa6M0A1cQUFalyjO2NkxAU1Y+qc+coAA4jmy1H1HWC3yzw6fkdbHG3s4RtNUqU S4W05AlQqKkPIVDmFUa6l1afBEogz6r42YK1MxAUpIi4kDFVCE7gi8wPm3MaEWPjOmTs8y 4HeoxXw88zX51qXb2G1y8YzI1bgco54= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 07/19] qapi: De-duplicate entity documentation generation code Date: Thu, 24 Oct 2019 13:02:25 +0200 Message-Id: <20191024110237.30963-8-armbru@redhat.com> In-Reply-To: <20191024110237.30963-1-armbru@redhat.com> References: <20191024110237.30963-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: UwY8DTMiNzyV6uNNWHTixA-1 X-Mimecast-Spam-Score: 0 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: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, pkrempa@redhat.com, mdroth@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" QAPISchemaGenDocVisitor.visit_command() duplicates texi_entity() for its boxed arguments case. The previous commit added another copy in .visit_event(). Replace texi_entity() by texi_type() and texi_msg(). Use texi_msg() for the boxed arguments case as well. Signed-off-by: Markus Armbruster --- scripts/qapi/doc.py | 82 ++++++++++++++++++++++----------------------- 1 file changed, 40 insertions(+), 42 deletions(-) diff --git a/scripts/qapi/doc.py b/scripts/qapi/doc.py index f2462c9877..c8c4bda153 100644 --- a/scripts/qapi/doc.py +++ b/scripts/qapi/doc.py @@ -12,7 +12,7 @@ from qapi.gen import QAPIGenDoc, QAPISchemaVisitor MSG_FMT =3D """ @deftypefn {type} {{}} {name} =20 -{body} +{body}{members}{features}{sections} @end deftypefn =20 """.format @@ -20,7 +20,7 @@ MSG_FMT =3D """ TYPE_FMT =3D """ @deftp {{{type}}} {name} =20 -{body} +{body}{members}{features}{sections} @end deftp =20 """.format @@ -149,7 +149,8 @@ def texi_member(member, desc, suffix): suffix, desc, texi_if(member.ifcond, prefix=3D'@*')) =20 =20 -def texi_members(doc, what, base, variants, member_func): +def texi_members(doc, what, base=3DNone, variants=3DNone, + member_func=3Dtexi_member): """Format the table of members""" items =3D '' for section in doc.args.values(): @@ -182,6 +183,13 @@ def texi_members(doc, what, base, variants, member_fun= c): return '\n@b{%s:}\n@table @asis\n%s@end table\n' % (what, items) =20 =20 +def texi_arguments(doc, boxed_arg_type): + if boxed_arg_type: + return ('\n@b{Arguments:} the members of @code{%s}\n' + % boxed_arg_type.name) + return texi_members(doc, 'Arguments') + + def texi_features(doc): """Format the table of features""" items =3D '' @@ -208,12 +216,22 @@ def texi_sections(doc, ifcond): return body =20 =20 -def texi_entity(doc, what, ifcond, base=3DNone, variants=3DNone, - member_func=3Dtexi_member): - return (texi_body(doc) - + texi_members(doc, what, base, variants, member_func) - + texi_features(doc) - + texi_sections(doc, ifcond)) +def texi_type(typ, doc, ifcond, members): + return TYPE_FMT(type=3Dtyp, + name=3Ddoc.symbol, + body=3Dtexi_body(doc), + members=3Dmembers, + features=3Dtexi_features(doc), + sections=3Dtexi_sections(doc, ifcond)) + + +def texi_msg(typ, doc, ifcond, members): + return MSG_FMT(type=3Dtyp, + name=3Ddoc.symbol, + body=3Dtexi_body(doc), + members=3Dmembers, + features=3Dtexi_features(doc), + sections=3Dtexi_sections(doc, ifcond)) =20 =20 class QAPISchemaGenDocVisitor(QAPISchemaVisitor): @@ -227,56 +245,36 @@ class QAPISchemaGenDocVisitor(QAPISchemaVisitor): =20 def visit_enum_type(self, name, info, ifcond, members, prefix): doc =3D self.cur_doc - self._gen.add(TYPE_FMT(type=3D'Enum', - name=3Ddoc.symbol, - body=3Dtexi_entity(doc, 'Values', ifcond, - member_func=3Dtexi_enum_va= lue))) + self._gen.add(texi_type('Enum', doc, ifcond, + texi_members(doc, 'Values', + member_func=3Dtexi_enum_value= ))) =20 def visit_object_type(self, name, info, ifcond, base, members, variant= s, features): doc =3D self.cur_doc if base and base.is_implicit(): base =3D None - self._gen.add(TYPE_FMT(type=3D'Object', - name=3Ddoc.symbol, - body=3Dtexi_entity(doc, 'Members', ifcond, - base, variants))) + self._gen.add(texi_type('Object', doc, ifcond, + texi_members(doc, 'Members', base, variant= s))) =20 def visit_alternate_type(self, name, info, ifcond, variants): doc =3D self.cur_doc - self._gen.add(TYPE_FMT(type=3D'Alternate', - name=3Ddoc.symbol, - body=3Dtexi_entity(doc, 'Members', ifcond))) + self._gen.add(texi_type('Alternate', doc, ifcond, + texi_members(doc, 'Members'))) =20 def visit_command(self, name, info, ifcond, arg_type, ret_type, gen, success_response, boxed, allow_oob, allow_preconfig, features): doc =3D self.cur_doc - if boxed: - body =3D texi_body(doc) - body +=3D ('\n@b{Arguments:} the members of @code{%s}\n' - % arg_type.name) - body +=3D texi_features(doc) - body +=3D texi_sections(doc, ifcond) - else: - body =3D texi_entity(doc, 'Arguments', ifcond) - self._gen.add(MSG_FMT(type=3D'Command', - name=3Ddoc.symbol, - body=3Dbody)) + self._gen.add(texi_msg('Command', doc, ifcond, + texi_arguments(doc, + arg_type if boxed else None)= )) =20 def visit_event(self, name, info, ifcond, arg_type, boxed): doc =3D self.cur_doc - if boxed: - body =3D texi_body(doc) - body +=3D ('\n@b{Arguments:} the members of @code{%s}\n' - % arg_type.name) - body +=3D texi_features(doc) - body +=3D texi_sections(doc, ifcond) - else: - body =3D texi_entity(doc, 'Arguments', ifcond) - self._gen.add(MSG_FMT(type=3D'Event', - name=3Ddoc.symbol, - body=3Dbody)) + self._gen.add(texi_msg('Event', doc, ifcond, + texi_arguments(doc, + arg_type if boxed else None)= )) =20 def symbol(self, doc, entity): if self._gen._body: --=20 2.21.0 From nobody Mon May 6 11:31:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1571919581; cv=none; d=zoho.com; s=zohoarc; b=nmdKpaBuymlluant07+apxtKnkcqen4ZbWOVU/W7aFJGgViuR6f4qb+QgqdhH/p4nS7xozbRqI2cLHm3vTUP2kuKpKUyk4hiMnKhULPL47UjVoAKBPH5yh/4q9j/ERhWBca0vlWcUDLh1d/dbAqtsRD6NV3sebmrJdQw06V5QaI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571919581; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NFlwmeBX9B2cG4o8rnjmFvP8JunKYpofIzrKPz+Y4nk=; b=StcaKBfY8k46shWNlOwdFmMWVg6Pm7++49xLhQVF5cr+/TLJSrusjRrpK/qAMs1GyAX3rp95A5RVQJHk7APczRGgUiNfw8ExUJGGXrmKBpuWgPPI172h0VyadyED3id+7SNd//pUexF3ta/0DaUglt4RFrVun844Vayx7yG4l88= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 157191958146355.45476083179278; Thu, 24 Oct 2019 05:19:41 -0700 (PDT) Received: from localhost ([::1]:40784 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNc5a-0000MG-Qb for importer@patchew.org; Thu, 24 Oct 2019 08:19:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59240) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNatG-0000se-Pr for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNatE-0004pr-Bs for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:50 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:21513 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iNatE-0004mg-4T for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:48 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-340-l3N0B6ZhOfWaoRnv9QKKbw-1; Thu, 24 Oct 2019 07:02:41 -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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id AED501800E00; Thu, 24 Oct 2019 11:02:40 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7C3405C21E; Thu, 24 Oct 2019 11:02:40 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 53DA21132989; Thu, 24 Oct 2019 13:02:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571914965; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NFlwmeBX9B2cG4o8rnjmFvP8JunKYpofIzrKPz+Y4nk=; b=fXkov4kRk50o2eqmqe8p/LxfDkFjP/22zq6icTs86wanhExIMxoWWyB6F4gGsJeS+B16Tj UiQJhAHfPlNbkGEvGbYEpYe1Sb5TL+k54KiI6/c3w61mlP9c8ltc9w3itD6U40j10fM4Js 97w5TOsqqDRLIc05KegBavD9tVlcxEU= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 08/19] qapi: Split .connect_doc(), .check_doc() off .check() Date: Thu, 24 Oct 2019 13:02:26 +0200 Message-Id: <20191024110237.30963-9-armbru@redhat.com> In-Reply-To: <20191024110237.30963-1-armbru@redhat.com> References: <20191024110237.30963-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: l3N0B6ZhOfWaoRnv9QKKbw-1 X-Mimecast-Spam-Score: 0 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: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, pkrempa@redhat.com, mdroth@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Splitting documentation checking off the .check() methods makes them a bit more focused, which is welcome, as some of them are pretty big. It also prepares the ground for the following commits. Signed-off-by: Markus Armbruster --- scripts/qapi/schema.py | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index f7d68a35f4..9b62c8d74d 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -51,6 +51,12 @@ class QAPISchemaEntity(object): os.path.dirname(schema.fname)) self._checked =3D True =20 + def connect_doc(self): + pass + + def check_doc(self): + pass + @property def ifcond(self): assert self._checked @@ -217,7 +223,10 @@ class QAPISchemaEnumType(QAPISchemaType): seen =3D {} for m in self.members: m.check_clash(self.info, seen) - if self.doc: + + def connect_doc(self): + if self.doc: + for m in self.members: self.doc.connect_member(m) =20 def is_implicit(self): @@ -345,8 +354,6 @@ class QAPISchemaObjectType(QAPISchemaType): for m in self.local_members: m.check(schema) m.check_clash(self.info, seen) - if self.doc: - self.doc.connect_member(m) members =3D seen.values() =20 if self.variants: @@ -358,9 +365,6 @@ class QAPISchemaObjectType(QAPISchemaType): for f in self.features: f.check_clash(self.info, seen) =20 - if self.doc: - self.doc.check() - self.members =3D members # mark completed =20 # Check that the members of this type do not cause duplicate JSON memb= ers, @@ -372,6 +376,15 @@ class QAPISchemaObjectType(QAPISchemaType): for m in self.members: m.check_clash(info, seen) =20 + def connect_doc(self): + if self.doc: + for m in self.local_members: + self.doc.connect_member(m) + + def check_doc(self): + if self.doc: + self.doc.check() + @property def ifcond(self): assert self._checked @@ -639,8 +652,13 @@ class QAPISchemaAlternateType(QAPISchemaType): "%s can't be distinguished from '%s'" % (v.describe(self.info), types_seen[qt])) types_seen[qt] =3D v.name - if self.doc: + + def connect_doc(self): + if self.doc: + for v in self.variants.variants: self.doc.connect_member(v) + + def check_doc(self): if self.doc: self.doc.check() =20 @@ -1043,6 +1061,8 @@ class QAPISchema(object): def check(self): for ent in self._entity_list: ent.check(self) + ent.connect_doc() + ent.check_doc() =20 def visit(self, visitor): visitor.visit_begin(self) --=20 2.21.0 From nobody Mon May 6 11:31:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1571916549; cv=none; d=zoho.com; s=zohoarc; b=EwaIiIHQ3SoPhKU33GlDmRrvTdokMneOL2M5ubpJMxoTOlDR72+VM+ZHehhwnyHsKN+rsgxt+mw0vr3N7d3SZOBlT1yq/t2lS4wh5UIRKlRthDtOWaGHOOgX6ieCH9YvX2K68G0RUE4Yigd/kS1WdvoaPazLd4wLQIip9exPcbk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571916549; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=OPBd4x/97RP023wsihC+zq3VLAl/9PZbaQaixKkNOCU=; b=QQeKF+zmCWp8eY27o/2NsoDbio8S/grPP7jjRfcY7XaAk/ceXPqF/SZJK5N+n+zqAOZCbVqou13FYs9TKaBqDJbuUR1WvjcTccMzZD1+Z/kwewftbJmNatWaMCChWh9tM6MHZ/nnI20lmbhUnhQQY5+7t51SLFswVPQaW58q/kg= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1571916549120418.31759551442894; Thu, 24 Oct 2019 04:29:09 -0700 (PDT) Received: from localhost ([::1]:39890 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNbIh-0003Jm-WF for importer@patchew.org; Thu, 24 Oct 2019 07:29:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59336) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNatK-0000zk-UY for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNatE-0004qN-Fb for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:54 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:53603 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iNatE-0004oF-8D for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:48 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-376-PUB9gDmxPZCTX_6Z8-QMnw-1; Thu, 24 Oct 2019 07:02:42 -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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 676E31800E04; Thu, 24 Oct 2019 11:02:41 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 33D84600C4; Thu, 24 Oct 2019 11:02:41 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 5C878113292F; Thu, 24 Oct 2019 13:02:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571914966; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OPBd4x/97RP023wsihC+zq3VLAl/9PZbaQaixKkNOCU=; b=SLWxCr3anMIxvDGhTi7mfPZh3FXf674TH1rkBngXSqxRYTiq8t7W+y3flKRXs+VyrmyMwx Agvx/pV+2Y95zFY5z3XnMQonfosZccA9RiPMnrzUxukTTNRAcumvGQO4MdEaJv2UbCI60N NaZyyL7jzdhm1e1lNQusKU6hLpH5NfE= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 09/19] qapi: Fix enum doc comment checking Date: Thu, 24 Oct 2019 13:02:27 +0200 Message-Id: <20191024110237.30963-10-armbru@redhat.com> In-Reply-To: <20191024110237.30963-1-armbru@redhat.com> References: <20191024110237.30963-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: PUB9gDmxPZCTX_6Z8-QMnw-1 X-Mimecast-Spam-Score: 0 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: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, pkrempa@redhat.com, mdroth@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Enumeration type documentation comments are not checked, as demonstrated by test doc-bad-enum-member. This is because we neglect to call self.doc.check() for enumeration types. Messed up in 816a57cd6e "qapi: Fix detection of bogus member documentation". Fix it. Signed-off-by: Markus Armbruster --- scripts/qapi/schema.py | 4 ++++ tests/qapi-schema/doc-bad-enum-member.err | 1 + tests/qapi-schema/doc-bad-enum-member.json | 1 - tests/qapi-schema/doc-bad-enum-member.out | 21 --------------------- 4 files changed, 5 insertions(+), 22 deletions(-) diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index 9b62c8d74d..0381e3cb40 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -229,6 +229,10 @@ class QAPISchemaEnumType(QAPISchemaType): for m in self.members: self.doc.connect_member(m) =20 + def check_doc(self): + if self.doc: + self.doc.check() + def is_implicit(self): # See QAPISchema._make_implicit_enum_type() and ._def_predefineds() return self.name.endswith('Kind') or self.name =3D=3D 'QType' diff --git a/tests/qapi-schema/doc-bad-enum-member.err b/tests/qapi-schema/= doc-bad-enum-member.err index e69de29bb2..dfa1e786d7 100644 --- a/tests/qapi-schema/doc-bad-enum-member.err +++ b/tests/qapi-schema/doc-bad-enum-member.err @@ -0,0 +1 @@ +doc-bad-enum-member.json:3: the following documented members are not in th= e declaration: a diff --git a/tests/qapi-schema/doc-bad-enum-member.json b/tests/qapi-schema= /doc-bad-enum-member.json index 9f32fe64b4..9cab35c6e8 100644 --- a/tests/qapi-schema/doc-bad-enum-member.json +++ b/tests/qapi-schema/doc-bad-enum-member.json @@ -1,5 +1,4 @@ # Members listed in the doc comment must exist in the actual schema -# BUG: nonexistent @a is not rejected =20 ## # @Foo: diff --git a/tests/qapi-schema/doc-bad-enum-member.out b/tests/qapi-schema/= doc-bad-enum-member.out index 6ca31c1e9b..e69de29bb2 100644 --- a/tests/qapi-schema/doc-bad-enum-member.out +++ b/tests/qapi-schema/doc-bad-enum-member.out @@ -1,21 +0,0 @@ -module None -object q_empty -enum QType - prefix QTYPE - member none - member qnull - member qnum - member qstring - member qdict - member qlist - member qbool -module doc-bad-enum-member.json -enum Foo - member b -doc symbol=3DFoo - body=3D - - arg=3Da -a - arg=3Db -b --=20 2.21.0 From nobody Mon May 6 11:31:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1571916135; cv=none; d=zoho.com; s=zohoarc; b=ht4wwGcz6nza8QAkj+ktdO8TeYsi3pASeMYGiQNuMp4rkTWrm13MEMzkLeU/ykwL1ptGXDjnVQ5nOeMj/jeovKHmYi90ng7jFEJpvAgLoKL3OlFfYkyyOWU/xH1bXP3eSlA0lrZELlOwnV1oY+LuC6WiKHi5bzXBAQl1BP6VkQc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571916135; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=y0LluG9x73pG1eSjKT6+/4tvxwpeWh3fys+DjJoQOMg=; b=EsJHmGyoxrvCiFU3wYdrzx48YU/7icUWkV7v+d3L+cdpk/JbMqRNSAccJnr5GiioKZtwF3/rEGZQqCGeOcPZWi5gZ6hZsg5yBUY7KdXh66gkTGsYsz3ddspgMJERiShQqme+QZZfOcEFIo+0YBlzbUTTerv1tw39NPGPeo6YpJc= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1571916135838406.87199598865675; Thu, 24 Oct 2019 04:22:15 -0700 (PDT) Received: from localhost ([::1]:38896 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNawG-0003ut-Kr for importer@patchew.org; Thu, 24 Oct 2019 07:05:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59237) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNatG-0000sc-Om for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNatE-0004pk-Ae for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:50 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:60251 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iNatE-0004mA-4m for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:48 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-32-_jn1AztyOcmJM2z2geaMwQ-1; Thu, 24 Oct 2019 07:02:42 -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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 72922800D5A; Thu, 24 Oct 2019 11:02:41 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3DA24600CC; Thu, 24 Oct 2019 11:02:41 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 6095D113294C; Thu, 24 Oct 2019 13:02:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571914964; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=y0LluG9x73pG1eSjKT6+/4tvxwpeWh3fys+DjJoQOMg=; b=f2+7BTENNjDXdpS7USRAoyXErWQjS8fuqJqo6MPS3Xg626T7MCKojvPq3M5gB92ctPipDg fkgN3dj6r+5p09TUTISRYg7rg9WtPXPdwyz8FtEdpPwoC3cwYsDDS+snEC+ZOe0D2ThaBW uMczbgN936sGbG9YwOQXgE9OBfTri9k= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 10/19] qapi: Clean up doc comment checking for implicit union base Date: Thu, 24 Oct 2019 13:02:28 +0200 Message-Id: <20191024110237.30963-11-armbru@redhat.com> In-Reply-To: <20191024110237.30963-1-armbru@redhat.com> References: <20191024110237.30963-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: _jn1AztyOcmJM2z2geaMwQ-1 X-Mimecast-Spam-Score: 0 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: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, pkrempa@redhat.com, mdroth@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" An object type's doc comment describes the type's members, less the ones defined in a named base type. Cases: * Struct: the members are defined in 'data' and inherited from 'base'. Since the base type cannot be implicit, the doc comment describes just 'data'. * Simple union: the only member is the implicit tag member @type, and the doc comment describes it. * Flat union with implicit base type: the members are defined in 'base', and the doc comment describes it. * Flat union with named base type: the members are inherited from 'base'. The doc comment describes no members. Before we can check a doc comment with .check_doc(), we need .connect_doc() connect each of its "argument sections" to the member it documents. For structs and simple unions, this is straightforward: the members in question are in .local_members, and .connect_doc() connects them. For flat unions with a named base type, it's trivial: .local_members is empty, and .connect_doc() does nothing. For flat unions with an implicit base type, it's tricky. We have QAPISchema._make_implicit_object_type() forward the union's doc comment to the implicit base type, so that the base type's .connect_doc() connects the members. The union's .connect_doc() does nothing, as .local_members is empty. Dirt effect: we check the doc comment twice, once for the union type, and once for the implicit base type. This is needlessly brittle and hard to understand. Clean up as follows. Make the union's .connect_doc() connect an implicit base's members itself. Do not forward the union's doc comment to its implicit base type. Requires extending .connect_doc() so it can work with a doc comment other than self.doc. Add an optional argument for that. Signed-off-by: Markus Armbruster --- scripts/qapi/schema.py | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index 0381e3cb40..c16dce1fe0 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -51,7 +51,7 @@ class QAPISchemaEntity(object): os.path.dirname(schema.fname)) self._checked =3D True =20 - def connect_doc(self): + def connect_doc(self, doc=3DNone): pass =20 def check_doc(self): @@ -224,10 +224,11 @@ class QAPISchemaEnumType(QAPISchemaType): for m in self.members: m.check_clash(self.info, seen) =20 - def connect_doc(self): - if self.doc: + def connect_doc(self, doc=3DNone): + doc =3D doc or self.doc + if doc: for m in self.members: - self.doc.connect_member(m) + doc.connect_member(m) =20 def check_doc(self): if self.doc: @@ -380,10 +381,13 @@ class QAPISchemaObjectType(QAPISchemaType): for m in self.members: m.check_clash(info, seen) =20 - def connect_doc(self): - if self.doc: + def connect_doc(self, doc=3DNone): + doc =3D doc or self.doc + if doc: + if self.base and self.base.is_implicit(): + self.base.connect_doc(doc) for m in self.local_members: - self.doc.connect_member(m) + doc.connect_member(m) =20 def check_doc(self): if self.doc: @@ -657,10 +661,11 @@ class QAPISchemaAlternateType(QAPISchemaType): % (v.describe(self.info), types_seen[qt])) types_seen[qt] =3D v.name =20 - def connect_doc(self): - if self.doc: + def connect_doc(self, doc=3DNone): + doc =3D doc or self.doc + if doc: for v in self.variants.variants: - self.doc.connect_member(v) + doc.connect_member(v) =20 def check_doc(self): if self.doc: @@ -974,7 +979,7 @@ class QAPISchema(object): tag_member =3D None if isinstance(base, dict): base =3D self._make_implicit_object_type( - name, info, doc, ifcond, + name, info, None, ifcond, 'base', self._make_members(base, info)) if tag_name: variants =3D [self._make_variant(key, value['type'], --=20 2.21.0 From nobody Mon May 6 11:31:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1571920134; cv=none; d=zoho.com; s=zohoarc; b=Jtsl9YY0CzXV+JoVSKK9m2n81mySEhCnJSv6L8qczT1E16UbG9IKe7YYrpefbV1s5s/B1YWdq/E4vDfyxA2Y0IBLujs0fH52tTFQUOoOk6UY1VAHKmW6qXmDONETcpEtD5p6GlHnPbW5WIlnHgptDA9alD3zfOovNgkcEtKyf1E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571920134; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RoDle9Zl6Br9Wi+V5CQIJNW09ClfW6am574Q+oXI2ow=; b=fnbFh9lb8U3awVvLMgJIUM0gd7zu1QlxUeJtPzdgMNSHfeH/VgSgAUUsip69CcJG1s5Kb6VD05RSGKizV7abUufF+hr3CHmlfJBLjadr3RaUXmKmC09lrZ8mr2Ku9PYxKF0qlj6slOkW2Ig9sABsdzmVMPbNFcv8HBu44HjIaNM= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 157192013419229.139729587535385; Thu, 24 Oct 2019 05:28:54 -0700 (PDT) Received: from localhost ([::1]:41058 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNcEW-0007M8-HZ for importer@patchew.org; Thu, 24 Oct 2019 08:28:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59386) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNatM-00012D-EH for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNatE-0004r2-OR for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:56 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:49874 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iNatE-0004mr-Dt for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:48 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-378-KXMHNDqtN6GtoXhD3Uao4g-1; Thu, 24 Oct 2019 07:02:42 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CEE2780183E; Thu, 24 Oct 2019 11:02:41 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 732231001B20; Thu, 24 Oct 2019 11:02:41 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 65F88113294D; Thu, 24 Oct 2019 13:02:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571914965; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RoDle9Zl6Br9Wi+V5CQIJNW09ClfW6am574Q+oXI2ow=; b=g0Rv2iwgf4WNr42I/vHuJ+x5Ki1lJs/29MbS5+XKsOSSt+SVpYiPTJPjzu9P8bFlIli0n2 aNk4e0ekp4GGJVQRl3bzSya4jFLs2T+WUj/EMIMK+CRp/j0zr+tpQw8d9kLOc/NRDtmWxI Qkv4VDWIq7EmM1bj8KsXR8keejauyDk= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 11/19] qapi: Fix doc comment checking for commands and events Date: Thu, 24 Oct 2019 13:02:29 +0200 Message-Id: <20191024110237.30963-12-armbru@redhat.com> In-Reply-To: <20191024110237.30963-1-armbru@redhat.com> References: <20191024110237.30963-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: KXMHNDqtN6GtoXhD3Uao4g-1 X-Mimecast-Spam-Score: 0 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: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, pkrempa@redhat.com, mdroth@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" When a command's 'data' is an object, its doc comment describes the arguments defined there. When 'data' names a type, the doc comment does not describe arguments. Instead, the doc generator inserts a pointer to the named type. An event's doc comment works the same. We don't actually check doc comments for commands and events. Instead, QAPISchema._def_command() forwards the doc comment to the implicit argument type, where it gets checked. Works because the check only cares for the implicit argument type's members. Not only is this needlessly hard to understand, it actually falls apart in two cases: * When 'data' is empty, there is nothing to forward to, and the doc comment remains unchecked. Demonstrated by test doc-bad-event-arg. * When 'data' names a type, we can't forward, as the type has its own doc comment. The command or event's doc comment remains unchecked. Demonstrated by test doc-bad-boxed-command-arg. The forwarding goes back to commit 069fb5b250 "qapi: Prepare for requiring more complete documentation", put to use in commit 816a57cd6e "qapi: Fix detection of bogus member documentation". That fix was incomplete. To fix this, make QAPISchemaCommand and QAPISchemaEvent check doc comments, and drop the forwarding of doc comments to implicit argument types. Signed-off-by: Markus Armbruster --- qapi/net.json | 2 -- scripts/qapi/doc.py | 1 + scripts/qapi/schema.py | 24 +++++++++++++++-- .../qapi-schema/doc-bad-boxed-command-arg.err | 1 + .../doc-bad-boxed-command-arg.json | 1 - .../qapi-schema/doc-bad-boxed-command-arg.out | 26 ------------------- tests/qapi-schema/doc-bad-event-arg.err | 1 + tests/qapi-schema/doc-bad-event-arg.json | 1 - tests/qapi-schema/doc-bad-event-arg.out | 19 -------------- 9 files changed, 25 insertions(+), 51 deletions(-) diff --git a/qapi/net.json b/qapi/net.json index 728990f4fb..4c96137811 100644 --- a/qapi/net.json +++ b/qapi/net.json @@ -723,8 +723,6 @@ # Trigger generation of broadcast RARP frames to update network switches. # This can be useful when network bonds fail-over the active slave. # -# @params: AnnounceParameters giving timing and repetition count of announ= ce -# # Example: # # -> { "execute": "announce-self", diff --git a/scripts/qapi/doc.py b/scripts/qapi/doc.py index c8c4bda153..6f1c17f71f 100644 --- a/scripts/qapi/doc.py +++ b/scripts/qapi/doc.py @@ -185,6 +185,7 @@ def texi_members(doc, what, base=3DNone, variants=3DNon= e, =20 def texi_arguments(doc, boxed_arg_type): if boxed_arg_type: + assert not doc.args return ('\n@b{Arguments:} the members of @code{%s}\n' % boxed_arg_type.name) return texi_members(doc, 'Arguments') diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index c16dce1fe0..06e37c9c49 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -739,6 +739,16 @@ class QAPISchemaCommand(QAPISchemaEntity): for f in self.features: f.check_clash(self.info, seen) =20 + def connect_doc(self, doc=3DNone): + doc =3D doc or self.doc + if doc: + if self.arg_type and self.arg_type.is_implicit(): + self.arg_type.connect_doc(doc) + + def check_doc(self): + if self.doc: + self.doc.check() + def visit(self, visitor): QAPISchemaEntity.visit(self, visitor) visitor.visit_command(self.name, self.info, self.ifcond, @@ -775,6 +785,16 @@ class QAPISchemaEvent(QAPISchemaEntity): "event's 'data' can take %s only with 'boxed': true" % self.arg_type.describe()) =20 + def connect_doc(self, doc=3DNone): + doc =3D doc or self.doc + if doc: + if self.arg_type and self.arg_type.is_implicit(): + self.arg_type.connect_doc(doc) + + def check_doc(self): + if self.doc: + self.doc.check() + def visit(self, visitor): QAPISchemaEntity.visit(self, visitor) visitor.visit_event(self.name, self.info, self.ifcond, @@ -1026,7 +1046,7 @@ class QAPISchema(object): features =3D expr.get('features', []) if isinstance(data, OrderedDict): data =3D self._make_implicit_object_type( - name, info, doc, ifcond, 'arg', self._make_members(data, i= nfo)) + name, info, None, ifcond, 'arg', self._make_members(data, = info)) if isinstance(rets, list): assert len(rets) =3D=3D 1 rets =3D self._make_array_type(rets[0], info) @@ -1042,7 +1062,7 @@ class QAPISchema(object): ifcond =3D expr.get('if') if isinstance(data, OrderedDict): data =3D self._make_implicit_object_type( - name, info, doc, ifcond, 'arg', self._make_members(data, i= nfo)) + name, info, None, ifcond, 'arg', self._make_members(data, = info)) self._def_entity(QAPISchemaEvent(name, info, doc, ifcond, data, bo= xed)) =20 def _def_exprs(self, exprs): diff --git a/tests/qapi-schema/doc-bad-boxed-command-arg.err b/tests/qapi-s= chema/doc-bad-boxed-command-arg.err index e69de29bb2..e1101b1667 100644 --- a/tests/qapi-schema/doc-bad-boxed-command-arg.err +++ b/tests/qapi-schema/doc-bad-boxed-command-arg.err @@ -0,0 +1 @@ +doc-bad-boxed-command-arg.json:9: the following documented members are not= in the declaration: a diff --git a/tests/qapi-schema/doc-bad-boxed-command-arg.json b/tests/qapi-= schema/doc-bad-boxed-command-arg.json index 2c265d2ca3..bd143241ec 100644 --- a/tests/qapi-schema/doc-bad-boxed-command-arg.json +++ b/tests/qapi-schema/doc-bad-boxed-command-arg.json @@ -1,5 +1,4 @@ # Boxed arguments are not to be documented with the command -# BUG: not rejected =20 ## # @Args: diff --git a/tests/qapi-schema/doc-bad-boxed-command-arg.out b/tests/qapi-s= chema/doc-bad-boxed-command-arg.out index 4ccd788253..e69de29bb2 100644 --- a/tests/qapi-schema/doc-bad-boxed-command-arg.out +++ b/tests/qapi-schema/doc-bad-boxed-command-arg.out @@ -1,26 +0,0 @@ -module None -object q_empty -enum QType - prefix QTYPE - member none - member qnull - member qnum - member qstring - member qdict - member qlist - member qbool -module doc-bad-boxed-command-arg.json -object Args - member a: int optional=3DFalse -command cmd-boxed Args -> None - gen=3DTrue success_response=3DTrue boxed=3DTrue oob=3DFalse preconfig= =3DFalse -doc symbol=3DArgs - body=3D - - arg=3Da -an argument -doc symbol=3Dcmd-boxed - body=3D - - arg=3Da -bogus diff --git a/tests/qapi-schema/doc-bad-event-arg.err b/tests/qapi-schema/do= c-bad-event-arg.err index e69de29bb2..114ff4a3c7 100644 --- a/tests/qapi-schema/doc-bad-event-arg.err +++ b/tests/qapi-schema/doc-bad-event-arg.err @@ -0,0 +1 @@ +doc-bad-event-arg.json:3: the following documented members are not in the = declaration: a diff --git a/tests/qapi-schema/doc-bad-event-arg.json b/tests/qapi-schema/d= oc-bad-event-arg.json index 80d4e1240b..23c83cc81f 100644 --- a/tests/qapi-schema/doc-bad-event-arg.json +++ b/tests/qapi-schema/doc-bad-event-arg.json @@ -1,5 +1,4 @@ # Arguments listed in the doc comment must exist in the actual schema -# BUG: nonexistent @a is not rejected =20 ## # @FOO: diff --git a/tests/qapi-schema/doc-bad-event-arg.out b/tests/qapi-schema/do= c-bad-event-arg.out index ad0367cd45..e69de29bb2 100644 --- a/tests/qapi-schema/doc-bad-event-arg.out +++ b/tests/qapi-schema/doc-bad-event-arg.out @@ -1,19 +0,0 @@ -module None -object q_empty -enum QType - prefix QTYPE - member none - member qnull - member qnum - member qstring - member qdict - member qlist - member qbool -module doc-bad-event-arg.json -event FOO None - boxed=3DFalse -doc symbol=3DFOO - body=3D - - arg=3Da -a --=20 2.21.0 From nobody Mon May 6 11:31:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1571916293; cv=none; d=zoho.com; s=zohoarc; b=U8jG/WGNtR+hW4O9D0r6Ottp1TtMYp89jcJPqV2Abp0oDlq1URtvNVVV4sgkc81o38gIRU+Q6thLP0RZ6pKX7/t1nEIZsw+8KIq4cG8S3QoLuzcC/kWJt/8KkOsNxD1uzfACIY/nD1ZEQdJ6kcW0aOrPyGmTQ11b3lfgvmyI9sA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571916293; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rUuZyBI5+Ihso7z459NcAIGfMCtpvZVrWlCZYt8BQyI=; b=C+WNVj6GtPkVBSboleB8U2l8nqAdl0gdQsakR5ZFXAYda3FVPTzr1a4Z97t1f+jPZZtJ60KVqev2jJnosyFSA3yx4VKBO1rf4ia2Bj22cqG/Yw+cKuDdO1XtRY3oglutGGjAIVPEezWTosfCXwmNXpk1Tzp70+SBp3qudcyeGAM= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1571916293253589.9064555823618; Thu, 24 Oct 2019 04:24:53 -0700 (PDT) Received: from localhost ([::1]:38939 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNazq-0002gq-DB for importer@patchew.org; Thu, 24 Oct 2019 07:09:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59236) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNatG-0000sb-Po for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNatE-0004qF-EJ for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:50 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:42824 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iNatE-0004oR-6c for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:48 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-378-n0nVzL8kOgWlUgDTEflufA-1; Thu, 24 Oct 2019 07:02:42 -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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id B0C031800E05; Thu, 24 Oct 2019 11:02:41 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7D267608C1; Thu, 24 Oct 2019 11:02:41 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 6AAF711328A8; Thu, 24 Oct 2019 13:02:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571914966; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rUuZyBI5+Ihso7z459NcAIGfMCtpvZVrWlCZYt8BQyI=; b=UyHuH8rV1+bGQokP4kQuP3SVRSgtnB/sTSj1ZWOC01T6VtQlUrfc5hQ+5jeYv2NiPPpYYy Wl6Ap+QYzHzEYyqV0ItmKnsLibYPlun3RKMusc7TGhcTb16L+9GB302d2eNz3tW8E5rpVH 0cQyeMUdPooCnPszOXti2b93E6I1OJg= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 12/19] qapi: Simplify ._make_implicit_object_type() Date: Thu, 24 Oct 2019 13:02:30 +0200 Message-Id: <20191024110237.30963-13-armbru@redhat.com> In-Reply-To: <20191024110237.30963-1-armbru@redhat.com> References: <20191024110237.30963-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: n0nVzL8kOgWlUgDTEflufA-1 X-Mimecast-Spam-Score: 0 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: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, pkrempa@redhat.com, mdroth@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" All callers now pass doc=3DNone. Drop the argument. Signed-off-by: Markus Armbruster --- scripts/qapi/schema.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index 06e37c9c49..27da4e0f7d 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -920,8 +920,7 @@ class QAPISchema(object): self._def_entity(QAPISchemaArrayType(name, info, element_type)) return name =20 - def _make_implicit_object_type(self, name, info, doc, ifcond, - role, members): + def _make_implicit_object_type(self, name, info, ifcond, role, members= ): if not members: return None # See also QAPISchemaObjectTypeMember.describe() @@ -939,7 +938,7 @@ class QAPISchema(object): # TODO kill simple unions or implement the disjunction assert (ifcond or []) =3D=3D typ._ifcond # pylint: disable=3Dp= rotected-access else: - self._def_entity(QAPISchemaObjectType(name, info, doc, ifcond, + self._def_entity(QAPISchemaObjectType(name, info, None, ifcond, None, members, None, [])) return name =20 @@ -986,7 +985,7 @@ class QAPISchema(object): assert len(typ) =3D=3D 1 typ =3D self._make_array_type(typ[0], info) typ =3D self._make_implicit_object_type( - typ, info, None, self.lookup_type(typ), + typ, info, self.lookup_type(typ), 'wrapper', [self._make_member('data', typ, None, info)]) return QAPISchemaObjectTypeVariant(case, info, typ, ifcond) =20 @@ -999,7 +998,7 @@ class QAPISchema(object): tag_member =3D None if isinstance(base, dict): base =3D self._make_implicit_object_type( - name, info, None, ifcond, + name, info, ifcond, 'base', self._make_members(base, info)) if tag_name: variants =3D [self._make_variant(key, value['type'], @@ -1046,7 +1045,7 @@ class QAPISchema(object): features =3D expr.get('features', []) if isinstance(data, OrderedDict): data =3D self._make_implicit_object_type( - name, info, None, ifcond, 'arg', self._make_members(data, = info)) + name, info, ifcond, 'arg', self._make_members(data, info)) if isinstance(rets, list): assert len(rets) =3D=3D 1 rets =3D self._make_array_type(rets[0], info) @@ -1062,7 +1061,7 @@ class QAPISchema(object): ifcond =3D expr.get('if') if isinstance(data, OrderedDict): data =3D self._make_implicit_object_type( - name, info, None, ifcond, 'arg', self._make_members(data, = info)) + name, info, ifcond, 'arg', self._make_members(data, info)) self._def_entity(QAPISchemaEvent(name, info, doc, ifcond, data, bo= xed)) =20 def _def_exprs(self, exprs): --=20 2.21.0 From nobody Mon May 6 11:31:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1571919267; cv=none; d=zoho.com; s=zohoarc; b=FfvMHdPhwVubiBQxA7pDHIKBwWnwDPTZPsw+rjsP1yT4ghguKWVeA+5JS852LTQJBdqkEfQkeuCJSw64/wfSAaGLroxhQkv5qQ8DbFTgZUl4lnQZHUijTgWayoGg5UZupjKoFYEKXdPVS1oNBE/QQ/e3ho63+M3VQQPrSj2MgtA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571919267; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=BXnSVx7Vzt0JuFqita9BC2V6+56l9afuz3z9CJAcVTI=; b=RXhL5WUt0E52Yjv0c4s/wGXn6+kfCFLSE/5PrbLTXFYXdTfYZ9NCKP79vQ0A2OrBSWN9gkFmxeQ1aTGirWQ/lZK3Dj12DHynIbSizCswnM7ATjuhR/FCYhtiz2CSnTSoJlIKWsaWqOxxZoFJkgpyqpekw1ArmNIodxZSXT9dlic= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1571919267915752.3138607184738; Thu, 24 Oct 2019 05:14:27 -0700 (PDT) Received: from localhost ([::1]:40728 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNc0X-0001r7-Of for importer@patchew.org; Thu, 24 Oct 2019 08:14:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59235) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNatG-0000sX-Nm for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNatE-0004q6-DU for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:50 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:54142 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iNatE-0004oY-5r for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:48 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-34-jsWVxz7KOnigqHoOmHG3Tw-1; Thu, 24 Oct 2019 07:02:43 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 15874107AD33; Thu, 24 Oct 2019 11:02:42 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D1A1A10027A9; Thu, 24 Oct 2019 11:02:41 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 6FFDE11328AA; Thu, 24 Oct 2019 13:02:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571914966; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BXnSVx7Vzt0JuFqita9BC2V6+56l9afuz3z9CJAcVTI=; b=YciLBqVCp4nOet18OWPA0Nk/9h+zvXKqjgcXTnmWmhrmHV1gaAwmfEJe3Mp1c6UO7BWK2g LLw6suP/oJCTPcpZzzk/Gk4BfwcqpyJprL3U4IpLbTpkkajvwjP4Llt5jmgjH0KBOJ+JHu Jq7xvXGJH4ZR+X50DYrxJkEtfP6FjTU= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 13/19] qapi: Eliminate .check_doc() overrides Date: Thu, 24 Oct 2019 13:02:31 +0200 Message-Id: <20191024110237.30963-14-armbru@redhat.com> In-Reply-To: <20191024110237.30963-1-armbru@redhat.com> References: <20191024110237.30963-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: jsWVxz7KOnigqHoOmHG3Tw-1 X-Mimecast-Spam-Score: 0 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: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, pkrempa@redhat.com, mdroth@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" All sub-classes of QAPISchemaEntity now override .check_doc() the same way, except for QAPISchemaType and and QAPISchemaArrayType. Put the overrides' code in QAPISchemaEntity.check_doc(), and drop the overrides. QAPISchemaType doesn't care because it's abstract. QAPISchemaArrayType doesn't care because its .doc is always None. Signed-off-by: Markus Armbruster --- scripts/qapi/schema.py | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index 27da4e0f7d..ee510f129b 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -55,7 +55,8 @@ class QAPISchemaEntity(object): pass =20 def check_doc(self): - pass + if self.doc: + self.doc.check() =20 @property def ifcond(self): @@ -230,10 +231,6 @@ class QAPISchemaEnumType(QAPISchemaType): for m in self.members: doc.connect_member(m) =20 - def check_doc(self): - if self.doc: - self.doc.check() - def is_implicit(self): # See QAPISchema._make_implicit_enum_type() and ._def_predefineds() return self.name.endswith('Kind') or self.name =3D=3D 'QType' @@ -389,10 +386,6 @@ class QAPISchemaObjectType(QAPISchemaType): for m in self.local_members: doc.connect_member(m) =20 - def check_doc(self): - if self.doc: - self.doc.check() - @property def ifcond(self): assert self._checked @@ -667,10 +660,6 @@ class QAPISchemaAlternateType(QAPISchemaType): for v in self.variants.variants: doc.connect_member(v) =20 - def check_doc(self): - if self.doc: - self.doc.check() - def c_type(self): return c_name(self.name) + pointer_suffix =20 @@ -745,10 +734,6 @@ class QAPISchemaCommand(QAPISchemaEntity): if self.arg_type and self.arg_type.is_implicit(): self.arg_type.connect_doc(doc) =20 - def check_doc(self): - if self.doc: - self.doc.check() - def visit(self, visitor): QAPISchemaEntity.visit(self, visitor) visitor.visit_command(self.name, self.info, self.ifcond, @@ -791,10 +776,6 @@ class QAPISchemaEvent(QAPISchemaEntity): if self.arg_type and self.arg_type.is_implicit(): self.arg_type.connect_doc(doc) =20 - def check_doc(self): - if self.doc: - self.doc.check() - def visit(self, visitor): QAPISchemaEntity.visit(self, visitor) visitor.visit_event(self.name, self.info, self.ifcond, --=20 2.21.0 From nobody Mon May 6 11:31:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1571919925; cv=none; d=zoho.com; s=zohoarc; b=NrdJ5tMp4AThK2F2UNi5HNNTN0+i9hNc5MqYkTmzQb5CmzUbRLN52Sg+xxAf2HMRzpBKVEdnxsLdBTS3VhyfbDUOwsbQZ9f4sFC4hU92goHsXb0cq7aYk+Lki1TkwCJTFQ4sOS6V/jgCVoSXVN5cDOX/+ck/77wNbbuC6N1H69c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571919925; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+GfmVbadjrgclZy0LJ41Pf6eZUvpccx4mCNTJBvCxeE=; b=nGzxO5M++/Gc5T8UWpgVIS8/GBsuQeZ2jE6oRTXtjGkTHqB0karvKFQ3iHtly3fgeZpUOtwUhj6tk9C2l2iea5KA0LvwD6vANlY0jFdevFK/klHEkpI686+KdOcpPeqK5AYfxpJ0LnKi7ZavMVSSLPxWVdLR4UojPIaF0eCJ7Vg= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1571919925024374.2716563076169; Thu, 24 Oct 2019 05:25:25 -0700 (PDT) Received: from localhost ([::1]:41000 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNcB9-00067c-JZ for importer@patchew.org; Thu, 24 Oct 2019 08:25:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59325) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNatK-0000yX-9F for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNatJ-0004ul-01 for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:54 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:47160 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iNatI-0004tQ-QE for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:52 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-150-cWe2SOjIOmuCks5uQDiCWw-1; Thu, 24 Oct 2019 07:02:43 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 11DAE476; Thu, 24 Oct 2019 11:02:42 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D14F0196B2; Thu, 24 Oct 2019 11:02:41 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 759051130341; Thu, 24 Oct 2019 13:02:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571914971; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+GfmVbadjrgclZy0LJ41Pf6eZUvpccx4mCNTJBvCxeE=; b=Xxyxg68t0tsB4Y0yMooD8NH4REXmz1MZyIgUqObSc0sBnsvLhA3SRa0y6+Se1BsndREuk2 4H1y2tmruFJmGqVj4K66SK0VW4JgH0LH7wmgU7bsB39EWgzsmW0TH1k7nzFA8wCC6q1xDt Nr1/1uM2+Bv8Elk0+pfhIZrKbypV77s= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 14/19] qapi: Fold normalize_if() into check_if() Date: Thu, 24 Oct 2019 13:02:32 +0200 Message-Id: <20191024110237.30963-15-armbru@redhat.com> In-Reply-To: <20191024110237.30963-1-armbru@redhat.com> References: <20191024110237.30963-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: cWe2SOjIOmuCks5uQDiCWw-1 X-Mimecast-Spam-Score: 0 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: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, pkrempa@redhat.com, mdroth@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" check_if() is always called together with normalize_if(). Fold the latter into the former. Signed-off-by: Markus Armbruster --- scripts/qapi/expr.py | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py index 7c7394f835..aa0fe69f99 100644 --- a/scripts/qapi/expr.py +++ b/scripts/qapi/expr.py @@ -95,12 +95,6 @@ def check_flags(expr, info): info, "flag '%s' may only use true value" % key) =20 =20 -def normalize_if(expr): - ifcond =3D expr.get('if') - if isinstance(ifcond, str): - expr['if'] =3D [ifcond] - - def check_if(expr, info, source): =20 def check_if_str(ifcond, info): @@ -126,6 +120,7 @@ def check_if(expr, info, source): check_if_str(elt, info) else: check_if_str(ifcond, info) + expr['if'] =3D [ifcond] =20 =20 def normalize_members(members): @@ -175,7 +170,6 @@ def check_type(value, info, source, raise QAPISemError(info, "%s uses reserved name" % key_source) check_keys(arg, info, key_source, ['type'], ['if']) check_if(arg, info, key_source) - normalize_if(arg) check_type(arg['type'], info, key_source, allow_array=3DTrue) =20 =20 @@ -198,7 +192,6 @@ def check_features(features, info): source =3D "%s '%s'" % (source, f['name']) check_name_str(f['name'], info, source) check_if(f, info, source) - normalize_if(f) =20 =20 def normalize_enum(expr): @@ -227,7 +220,6 @@ def check_enum(expr, info): check_name_str(member['name'], info, source, enum_member=3DTrue, permit_upper=3Dpermit_upper) check_if(member, info, source) - normalize_if(member) =20 =20 def check_struct(expr, info): @@ -259,7 +251,6 @@ def check_union(expr, info): check_name_str(key, info, source) check_keys(value, info, source, ['type'], ['if']) check_if(value, info, source) - normalize_if(value) check_type(value['type'], info, source, allow_array=3Dnot base) =20 =20 @@ -273,7 +264,6 @@ def check_alternate(expr, info): check_name_str(key, info, source) check_keys(value, info, source, ['type'], ['if']) check_if(value, info, source) - normalize_if(value) check_type(value['type'], info, source) =20 =20 @@ -376,7 +366,6 @@ def check_exprs(exprs): else: assert False, 'unexpected meta type' =20 - normalize_if(expr) check_if(expr, info, meta) check_flags(expr, info) =20 --=20 2.21.0 From nobody Mon May 6 11:31:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1571916042; cv=none; d=zoho.com; s=zohoarc; b=Pn6Usokou3/SpEoTPNnkKp7w1s6PJfqkcLNzEyXyS3S83ereGWANICKK2vO3wr447f0j4hsuinWDcCzmIQ1KbwoJNqtn+46XIaMZHJdGzZSqlLung2XuikAy8QiOp0EeUDAktoSrM117nzAOE0NRZ88iZyFQk3Tyy4WMtTExkx8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571916042; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TS6mWmulSsOlAprbPsy9Eyv9dHRNJ+A89O7z6zn2tvg=; b=MgHaXLwtcO32KNm4v3+Xd5JdnLNtxoPp3mlkNTxDqzXAeEB8kCkdJlkG76r1K/zxIwHsTQf1m3u+U41B9ez9GSjEoIGcCwLfmoyrUryatVdSEHPSlhgZt8+nDPd4B1NXRK6vf4mBgmuT6f1pmIqwywN0tyj7Sq0kcO2GtQnjkbI= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1571916042937184.39252774968293; Thu, 24 Oct 2019 04:20:42 -0700 (PDT) Received: from localhost ([::1]:39296 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNb7m-0002U1-Kv for importer@patchew.org; Thu, 24 Oct 2019 07:17:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59313) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNatJ-0000xi-RX for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNatE-0004pF-5H for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:53 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:20743 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iNatC-0004mK-66 for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:46 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-278-vMQ4mVauP-C8VRjmJYCDyQ-1; Thu, 24 Oct 2019 07:02:43 -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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 139E6107AD31; Thu, 24 Oct 2019 11:02:42 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D3DE1608C1; Thu, 24 Oct 2019 11:02:41 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 7AFCF1130344; Thu, 24 Oct 2019 13:02:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571914964; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TS6mWmulSsOlAprbPsy9Eyv9dHRNJ+A89O7z6zn2tvg=; b=dmNxLKCeGB3d/7yROQ8ztDpiQiHK+6EYTpgRKAX0UJ+IRMZYXhD5m0g1WQV2ixzsMxbAZk dRlXjjka1IYMjWySNtrh2OJd2iXQIlEILA1g5vQD6e7GTXlYA/81XmT5rkNJz3A2gjENbm CRyB57A6LLc8x85BsZ/F/8X92LlIFLk= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 15/19] qapi: Fold normalize_features() into check_features() Date: Thu, 24 Oct 2019 13:02:33 +0200 Message-Id: <20191024110237.30963-16-armbru@redhat.com> In-Reply-To: <20191024110237.30963-1-armbru@redhat.com> References: <20191024110237.30963-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: vMQ4mVauP-C8VRjmJYCDyQ-1 X-Mimecast-Spam-Score: 0 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: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, pkrempa@redhat.com, mdroth@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" check_features() is always called together with normalize_features(): the former in check_struct() and check_command(), the latter in their caller check_exprs(). Fold the latter into the former. Signed-off-by: Markus Armbruster --- scripts/qapi/expr.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py index aa0fe69f99..66014e2bb2 100644 --- a/scripts/qapi/expr.py +++ b/scripts/qapi/expr.py @@ -173,17 +173,13 @@ def check_type(value, info, source, check_type(arg['type'], info, key_source, allow_array=3DTrue) =20 =20 -def normalize_features(features): - if isinstance(features, list): - features[:] =3D [f if isinstance(f, dict) else {'name': f} - for f in features] - - def check_features(features, info): if features is None: return if not isinstance(features, list): raise QAPISemError(info, "'features' must be an array") + features[:] =3D [f if isinstance(f, dict) else {'name': f} + for f in features] for f in features: source =3D "'features' member" assert isinstance(f, dict) @@ -347,7 +343,6 @@ def check_exprs(exprs): check_keys(expr, info, meta, ['struct', 'data'], ['base', 'if', 'features']) normalize_members(expr['data']) - normalize_features(expr.get('features')) check_struct(expr, info) elif meta =3D=3D 'command': check_keys(expr, info, meta, @@ -356,7 +351,6 @@ def check_exprs(exprs): 'gen', 'success-response', 'allow-oob', 'allow-preconfig']) normalize_members(expr.get('data')) - normalize_features(expr.get('features')) check_command(expr, info) elif meta =3D=3D 'event': check_keys(expr, info, meta, --=20 2.21.0 From nobody Mon May 6 11:31:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1571916089; cv=none; d=zoho.com; s=zohoarc; b=FHQBxxGBmGpgz1QWq8JlQrT/jXA52p51d/XgU5KSU9hNQBSkF/+tRmEVt5QvkoCR0RAWljxz5SY+sNcRZiFuy6wMT7tDHbbFMGoBm4OpNYUQKkSKkaTLH/2XZ4QMPSnilVY0mR5DPxfygBzJBsS8DTl1iVDSDUi102qOcOA7kk4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571916089; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=QN4XS8mVxl3mT4akw3IWg+VFgDuH1hftq+VYLTzdD0g=; b=bXBQXJYgupdxYcbzv4YeHbKfJ1iZuegz+wZTgdfQlpLmwi2QWUVGkgwdE7Xh1XXtUztdWKU7+FqSt/ioI2pt4PIWxMMkuJO966zJXfJjzhw9P03p5Itlh/BWHkXGbmeDDnfoUFUidklhN5IvdIxpowWIou9yVS+8xeNoNXfrN5Q= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1571916089596826.756929532705; Thu, 24 Oct 2019 04:21:29 -0700 (PDT) Received: from localhost ([::1]:38940 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNazu-0002jF-UT for importer@patchew.org; Thu, 24 Oct 2019 07:09:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59242) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNatG-0000sf-OU for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNatE-0004qj-Kv for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:50 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:51068 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iNatE-0004ow-As for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:48 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-262-VEVY2JijNAmKFRPGTlJE8g-1; Thu, 24 Oct 2019 07:02:43 -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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1D2AD107AD34; Thu, 24 Oct 2019 11:02:42 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D5CD860BF3; Thu, 24 Oct 2019 11:02:41 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 7F8CE1130346; Thu, 24 Oct 2019 13:02:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571914967; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QN4XS8mVxl3mT4akw3IWg+VFgDuH1hftq+VYLTzdD0g=; b=Rqb+nr/b/W17INdm0iQ6hNwxMft/L7bW5XZoxeoXpMQSZDsYMapvXnPb1I4WPPsU27PrJm MzGv1BkT0G2bjv9RycVbd26vdB7CKp/lP3JrZciP+kRMaWyK8mU5otEhagu1GUbEItX9Qv etV42ELLw41spfxl19k4YZkL5ob24Uc= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 16/19] qapi: Fold normalize_enum() into check_enum() Date: Thu, 24 Oct 2019 13:02:34 +0200 Message-Id: <20191024110237.30963-17-armbru@redhat.com> In-Reply-To: <20191024110237.30963-1-armbru@redhat.com> References: <20191024110237.30963-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: VEVY2JijNAmKFRPGTlJE8g-1 X-Mimecast-Spam-Score: 0 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: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, pkrempa@redhat.com, mdroth@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" check_features() is always called together with normalize_features(). Fold the latter into the former. Signed-off-by: Markus Armbruster --- scripts/qapi/expr.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py index 66014e2bb2..d7a289eded 100644 --- a/scripts/qapi/expr.py +++ b/scripts/qapi/expr.py @@ -190,12 +190,6 @@ def check_features(features, info): check_if(f, info, source) =20 =20 -def normalize_enum(expr): - if isinstance(expr['data'], list): - expr['data'] =3D [m if isinstance(m, dict) else {'name': m} - for m in expr['data']] - - def check_enum(expr, info): name =3D expr['enum'] members =3D expr['data'] @@ -208,6 +202,8 @@ def check_enum(expr, info): =20 permit_upper =3D name in info.pragma.name_case_whitelist =20 + members[:] =3D [m if isinstance(m, dict) else {'name': m} + for m in members] for member in members: source =3D "'data' member" check_keys(member, info, source, ['name'], ['if']) @@ -325,7 +321,6 @@ def check_exprs(exprs): if meta =3D=3D 'enum': check_keys(expr, info, meta, ['enum', 'data'], ['if', 'prefix']) - normalize_enum(expr) check_enum(expr, info) elif meta =3D=3D 'union': check_keys(expr, info, meta, --=20 2.21.0 From nobody Mon May 6 11:31:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1571916328; cv=none; d=zoho.com; s=zohoarc; b=INp3EwPo4OYar7oIg6eSICZ6sIX1vYU/Uch+WVmFLPHzDlmgFmj2A96yzW87fSsekTP6f1vxy/tSgAMFbqnmrY1dbn9VPkl6eCbxNHN6ZgQ/1X1R/xk/QciWZc1PdowVp0uLhspq3QN7rvu8daALv3PyzB8ydIjKI5Ff/8s1bno= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571916328; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=HNo8W5kBLPXth+ISSC7U9Yf3Hu3WHiltTwo4vNi9h2Q=; b=K57QlSf8kVc4OFYyjiJYQVHYNVOYvBoGMikrK/WdCJxIIsUAKhr3Jzclci7RzJmL8Lc+iP/9d//neRY+8XleDUotPxj5mI4ZAfL/YbypX1ulVRIAi5XoUBR4H9zUIle/ATsjExV9ns/T8RKy0UHOb2gZxXVw95pNroGFLSYlwIs= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1571916328265464.3821551494194; Thu, 24 Oct 2019 04:25:28 -0700 (PDT) Received: from localhost ([::1]:39792 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNbF8-0002Bx-Uq for importer@patchew.org; Thu, 24 Oct 2019 07:25:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59341) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNatL-0000zo-0v for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNatE-0004qe-Ky for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:54 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:29323 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iNatE-0004od-9T for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:48 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-158-8iBBIsdTP_qKRAsWWt5p0w-1; Thu, 24 Oct 2019 07:02:43 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 60883107AD35; Thu, 24 Oct 2019 11:02:42 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0605752DD; Thu, 24 Oct 2019 11:02:42 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 843041130348; Thu, 24 Oct 2019 13:02:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571914967; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HNo8W5kBLPXth+ISSC7U9Yf3Hu3WHiltTwo4vNi9h2Q=; b=Qy3rJJS2yWn5996N7bTkawpsllkOSTvb9FVKMCK8hOLlckh1/2UdovkbL3aVojGv5EP56m WTCxuIaOsCS6TvEvxdNNDx+PPEGDNs3pWOd6hYozAW0FPMa43JfR91JSHfKcFQiEDRusIF GYscBAQWSWZs5KinEfkxiBqbDOqSyDY= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 17/19] qapi: Lift features into QAPISchemaEntity Date: Thu, 24 Oct 2019 13:02:35 +0200 Message-Id: <20191024110237.30963-18-armbru@redhat.com> In-Reply-To: <20191024110237.30963-1-armbru@redhat.com> References: <20191024110237.30963-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: 8iBBIsdTP_qKRAsWWt5p0w-1 X-Mimecast-Spam-Score: 0 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: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, pkrempa@redhat.com, mdroth@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Commit 6a8c0b5102 "qapi: Add feature flags to struct types" added features to QAPISchemaObjectType. Commit a95daa5093 "qapi: Add feature flags to commands in qapi" added them to QAPISchemaCommand, duplicating the code. Tolerable, but the duplication will only get worse as we add features to more definitions. To de-duplicate, lift features from QAPISchemaObjectType and QAPISchemaCommand into QAPISchemaEntity. Signed-off-by: Markus Armbruster --- scripts/qapi/schema.py | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index ee510f129b..bdea9482fc 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -27,8 +27,11 @@ from qapi.parser import QAPISchemaParser class QAPISchemaEntity(object): meta =3D None =20 - def __init__(self, name, info, doc, ifcond=3DNone): + def __init__(self, name, info, doc, ifcond=3DNone, features=3DNone): assert name is None or isinstance(name, str) + for f in features or []: + assert isinstance(f, QAPISchemaFeature) + f.set_defined_in(name) self.name =3D name self._module =3D None # For explicitly defined entities, info points to the (explicit) @@ -39,6 +42,7 @@ class QAPISchemaEntity(object): self.info =3D info self.doc =3D doc self._ifcond =3D ifcond or [] + self.features =3D features or [] self._checked =3D False =20 def c_name(self): @@ -49,6 +53,10 @@ class QAPISchemaEntity(object): if self.info: self._module =3D os.path.relpath(self.info.fname, os.path.dirname(schema.fname)) + seen =3D {} + for f in self.features: + f.check_clash(self.info, seen) + self._checked =3D True =20 def connect_doc(self, doc=3DNone): @@ -307,7 +315,7 @@ class QAPISchemaObjectType(QAPISchemaType): # struct has local_members, optional base, and no variants # flat union has base, variants, and no local_members # simple union has local_members, variants, and no base - QAPISchemaType.__init__(self, name, info, doc, ifcond) + QAPISchemaType.__init__(self, name, info, doc, ifcond, features) self.meta =3D 'union' if variants else 'struct' assert base is None or isinstance(base, str) for m in local_members: @@ -316,15 +324,11 @@ class QAPISchemaObjectType(QAPISchemaType): if variants is not None: assert isinstance(variants, QAPISchemaObjectTypeVariants) variants.set_defined_in(name) - for f in features: - assert isinstance(f, QAPISchemaFeature) - f.set_defined_in(name) self._base_name =3D base self.base =3D None self.local_members =3D local_members self.variants =3D variants self.members =3D None - self.features =3D features =20 def check(self, schema): # This calls another type T's .check() exactly when the C @@ -362,11 +366,6 @@ class QAPISchemaObjectType(QAPISchemaType): self.variants.check(schema, seen) self.variants.check_clash(self.info, seen) =20 - # Features are in a name space separate from members - seen =3D {} - for f in self.features: - f.check_clash(self.info, seen) - self.members =3D members # mark completed =20 # Check that the members of this type do not cause duplicate JSON memb= ers, @@ -678,12 +677,9 @@ class QAPISchemaCommand(QAPISchemaEntity): def __init__(self, name, info, doc, ifcond, arg_type, ret_type, gen, success_response, boxed, allow_oob, allow_preconfig, features): - QAPISchemaEntity.__init__(self, name, info, doc, ifcond) + QAPISchemaEntity.__init__(self, name, info, doc, ifcond, features) assert not arg_type or isinstance(arg_type, str) assert not ret_type or isinstance(ret_type, str) - for f in features: - assert isinstance(f, QAPISchemaFeature) - f.set_defined_in(name) self._arg_type_name =3D arg_type self.arg_type =3D None self._ret_type_name =3D ret_type @@ -693,7 +689,6 @@ class QAPISchemaCommand(QAPISchemaEntity): self.boxed =3D boxed self.allow_oob =3D allow_oob self.allow_preconfig =3D allow_preconfig - self.features =3D features =20 def check(self, schema): QAPISchemaEntity.check(self, schema) @@ -723,11 +718,6 @@ class QAPISchemaCommand(QAPISchemaEntity): "command's 'returns' cannot take %s" % self.ret_type.describe()) =20 - # Features are in a name space separate from members - seen =3D {} - for f in self.features: - f.check_clash(self.info, seen) - def connect_doc(self, doc=3DNone): doc =3D doc or self.doc if doc: --=20 2.21.0 From nobody Mon May 6 11:31:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1571916356; cv=none; d=zoho.com; s=zohoarc; b=Y9y3/1xakFVBQ5bNpHNB90TaEe0q4DeugdT2KvLQVTuR7e5txyMhza7j75eVGoV+V2HH6AGE4A4YDAkMSRoAbEpF/5pK2uiMtDk3Us2ITFuzWAASnDCEYZWEZluypkJmf03PTRnT3uQcitO+BXxcn7fZ6MA/3NBtDnllTyvdJJU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571916356; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Us1Laa7ty3LIOEynSe01xNZMvnTUOEgxnDLSnaNnnIs=; b=d0HzevfkHp2pkidV2TpXpe9KhNmygQ2WGgT//qYXMI+MrdYqv0jZTqYuEMSLAqzOj+HlAPGJZx/2ChgsA+24S0m+irU3khFmLmjshb2WB9dg3KIMLNd8hMIouI+AGuXGKMnvoYFFCEyr0dYNvr8hDBkO1IouHA7aywlldEQ71Nk= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1571916356926784.7709955501621; Thu, 24 Oct 2019 04:25:56 -0700 (PDT) Received: from localhost ([::1]:38986 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNb3Z-0002Sa-Tu for importer@patchew.org; Thu, 24 Oct 2019 07:13:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59290) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNatI-0000ug-MQ for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNatE-0004qw-Nj for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:52 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:52250 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iNatE-0004oV-D2 for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:48 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-56-7yns4gIlNnq6MfKU3VciHA-1; Thu, 24 Oct 2019 07:02:43 -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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 407041800E06; Thu, 24 Oct 2019 11:02:42 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0A0FE5D9CA; Thu, 24 Oct 2019 11:02:42 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 88E67113034A; Thu, 24 Oct 2019 13:02:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571914966; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Us1Laa7ty3LIOEynSe01xNZMvnTUOEgxnDLSnaNnnIs=; b=UQ0kAXvTvOz8IFtxfJpzm1Zw5ZomdOSDzfp/JyOmAiCS+K8f3tAQ5IISxSdqMVqGH/IFlh /aZCyQa358IO3Uutwd1UdopIS4OqfYXtM0SOIPrE5FaGTJC+qEYCXvW5sYjg07da67jaAc 7qBlrWDYowOp//u5NjpuDK8l9phvhOk= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 18/19] qapi: Polish reporting of bogus member documentation Date: Thu, 24 Oct 2019 13:02:36 +0200 Message-Id: <20191024110237.30963-19-armbru@redhat.com> In-Reply-To: <20191024110237.30963-1-armbru@redhat.com> References: <20191024110237.30963-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: 7yns4gIlNnq6MfKU3VciHA-1 X-Mimecast-Spam-Score: 0 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: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, pkrempa@redhat.com, mdroth@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Improve error messages from the following documented members are not in the declaration: a the following documented members are not in the declaration: aa, bb to the more concise documented member 'a' does not exist documented members 'aa', 'bb' do not exist Signed-off-by: Markus Armbruster --- scripts/qapi/parser.py | 6 ++++-- tests/qapi-schema/doc-bad-alternate-member.err | 2 +- tests/qapi-schema/doc-bad-boxed-command-arg.err | 2 +- tests/qapi-schema/doc-bad-command-arg.err | 2 +- tests/qapi-schema/doc-bad-enum-member.err | 2 +- tests/qapi-schema/doc-bad-event-arg.err | 2 +- tests/qapi-schema/doc-bad-union-member.err | 2 +- 7 files changed, 10 insertions(+), 8 deletions(-) diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index e800876ad1..6c45a00cf4 100644 --- a/scripts/qapi/parser.py +++ b/scripts/qapi/parser.py @@ -566,5 +566,7 @@ class QAPIDoc(object): if bogus: raise QAPISemError( self.info, - "the following documented members are not in " - "the declaration: %s" % ", ".join(bogus)) + "documented member%s '%s' %s not exist" + % ("s" if len(bogus) > 1 else "", + "', '".join(bogus), + "do" if len(bogus) > 1 else "does")) diff --git a/tests/qapi-schema/doc-bad-alternate-member.err b/tests/qapi-sc= hema/doc-bad-alternate-member.err index a1c282f935..d7286bb57c 100644 --- a/tests/qapi-schema/doc-bad-alternate-member.err +++ b/tests/qapi-schema/doc-bad-alternate-member.err @@ -1 +1 @@ -doc-bad-alternate-member.json:3: the following documented members are not = in the declaration: aa, bb +doc-bad-alternate-member.json:3: documented members 'aa', 'bb' do not exist diff --git a/tests/qapi-schema/doc-bad-boxed-command-arg.err b/tests/qapi-s= chema/doc-bad-boxed-command-arg.err index e1101b1667..7137af3ec9 100644 --- a/tests/qapi-schema/doc-bad-boxed-command-arg.err +++ b/tests/qapi-schema/doc-bad-boxed-command-arg.err @@ -1 +1 @@ -doc-bad-boxed-command-arg.json:9: the following documented members are not= in the declaration: a +doc-bad-boxed-command-arg.json:9: documented member 'a' does not exist diff --git a/tests/qapi-schema/doc-bad-command-arg.err b/tests/qapi-schema/= doc-bad-command-arg.err index 153ea0330a..18ed076cef 100644 --- a/tests/qapi-schema/doc-bad-command-arg.err +++ b/tests/qapi-schema/doc-bad-command-arg.err @@ -1 +1 @@ -doc-bad-command-arg.json:3: the following documented members are not in th= e declaration: b +doc-bad-command-arg.json:3: documented member 'b' does not exist diff --git a/tests/qapi-schema/doc-bad-enum-member.err b/tests/qapi-schema/= doc-bad-enum-member.err index dfa1e786d7..7efeb47363 100644 --- a/tests/qapi-schema/doc-bad-enum-member.err +++ b/tests/qapi-schema/doc-bad-enum-member.err @@ -1 +1 @@ -doc-bad-enum-member.json:3: the following documented members are not in th= e declaration: a +doc-bad-enum-member.json:3: documented member 'a' does not exist diff --git a/tests/qapi-schema/doc-bad-event-arg.err b/tests/qapi-schema/do= c-bad-event-arg.err index 114ff4a3c7..d13cacf21f 100644 --- a/tests/qapi-schema/doc-bad-event-arg.err +++ b/tests/qapi-schema/doc-bad-event-arg.err @@ -1 +1 @@ -doc-bad-event-arg.json:3: the following documented members are not in the = declaration: a +doc-bad-event-arg.json:3: documented member 'a' does not exist diff --git a/tests/qapi-schema/doc-bad-union-member.err b/tests/qapi-schema= /doc-bad-union-member.err index 8b9d36eab1..6dd2726a65 100644 --- a/tests/qapi-schema/doc-bad-union-member.err +++ b/tests/qapi-schema/doc-bad-union-member.err @@ -1 +1 @@ -doc-bad-union-member.json:3: the following documented members are not in t= he declaration: a, b +doc-bad-union-member.json:3: documented members 'a', 'b' do not exist --=20 2.21.0 From nobody Mon May 6 11:31:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1571916838; cv=none; d=zoho.com; s=zohoarc; b=RA1A949iLe6F37u3e3in1ASN9Gv/jaJPzsGT2h3VZeiRh4oLCrLrsmYgJTfqQJezoE7tijaYx8FydMGJFO86DdAuLyjGZa9PwyeWprTrjM3iu7xGjeWVge5bdJnZbUFZRTTRDoV2EcWROxYigQ+jomdutVJyiCg+tvj3R1Rz9jY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571916838; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=iOEcPd3gG1rwZDF+O6gIueB0do2koRN51n2cuRDs3gs=; b=cBSANVWF2+XYRNx8v67JM7TrhMM1/0CfL2tPbmqZWbtko3LHf8GCTQm4F5s/BvDccTDC5ywwxUa6nss07JUyh7rercUcUbHXtrd5GRSSvzo/jZwLSStMs6WnbnKC0SqbrkOz2nxy63MeFCwsiojq+bU6wl5aiL0iibB58dMtMGc= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1571916838354693.2215019044888; Thu, 24 Oct 2019 04:33:58 -0700 (PDT) Received: from localhost ([::1]:39976 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNbNM-0003xs-8y for importer@patchew.org; Thu, 24 Oct 2019 07:33:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59384) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNatM-000126-Aw for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNatI-0004uK-JU for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:56 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:31206 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iNatG-0004r0-Kd for qemu-devel@nongnu.org; Thu, 24 Oct 2019 07:02:50 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-288-XXu_ikWpORqD9wob7IWzdg-1; Thu, 24 Oct 2019 07:02:43 -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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 859735E4; Thu, 24 Oct 2019 11:02:42 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2BD5D60BF3; Thu, 24 Oct 2019 11:02:42 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 8E311112FB55; Thu, 24 Oct 2019 13:02:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571914968; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iOEcPd3gG1rwZDF+O6gIueB0do2koRN51n2cuRDs3gs=; b=KwN6E4taA6gl4uPbdc8M9dyZz8W+jWitzJKETKqw6Kyb4Xq9i3WOLJfSvgj25EdwE8yDp2 rjbXJG3lIeHGdQjxs2pXN9vqjrTe67ox3uBtzp3034Jk3zXylNo+wWPdbE6ka1PO8MItUw WLQDdAEmBgS7TwhLnH8hmgYvptbMNa8= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 19/19] qapi: Check feature documentation against the schema Date: Thu, 24 Oct 2019 13:02:37 +0200 Message-Id: <20191024110237.30963-20-armbru@redhat.com> In-Reply-To: <20191024110237.30963-1-armbru@redhat.com> References: <20191024110237.30963-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: XXu_ikWpORqD9wob7IWzdg-1 X-Mimecast-Spam-Score: 0 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: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, pkrempa@redhat.com, mdroth@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Commit f3ed93d545 "qapi: Allow documentation for features" neglected to check documentation against the schema. Fix that: check them the same way we check arguments. Signed-off-by: Markus Armbruster --- scripts/qapi/parser.py | 31 +++++++++++++++++------- scripts/qapi/schema.py | 2 ++ tests/qapi-schema/doc-bad-feature.err | 1 + tests/qapi-schema/doc-bad-feature.json | 1 - tests/qapi-schema/doc-bad-feature.out | 19 --------------- tests/qapi-schema/doc-undoc-feature.err | 2 ++ tests/qapi-schema/doc-undoc-feature.json | 1 - tests/qapi-schema/doc-undoc-feature.out | 21 ---------------- 8 files changed, 27 insertions(+), 51 deletions(-) diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index 6c45a00cf4..342792e410 100644 --- a/scripts/qapi/parser.py +++ b/scripts/qapi/parser.py @@ -555,18 +555,31 @@ class QAPIDoc(object): self.args[member.name] =3D QAPIDoc.ArgSection(member.name) self.args[member.name].connect(member) =20 + def connect_feature(self, feature): + if feature.name not in self.features: + raise QAPISemError(feature.info, + "feature '%s' lacks documentation" + % feature.name) + self.features[feature.name] =3D QAPIDoc.ArgSection(feature.nam= e) + self.features[feature.name].connect(feature) + def check_expr(self, expr): if self.has_section('Returns') and 'command' not in expr: raise QAPISemError(self.info, "'Returns:' is only valid for commands") =20 def check(self): - bogus =3D [name for name, section in self.args.items() - if not section.member] - if bogus: - raise QAPISemError( - self.info, - "documented member%s '%s' %s not exist" - % ("s" if len(bogus) > 1 else "", - "', '".join(bogus), - "do" if len(bogus) > 1 else "does")) + + def check_args_section(args, info, what): + bogus =3D [name for name, section in args.items() + if not section.member] + if bogus: + raise QAPISemError( + self.info, + "documented member%s '%s' %s not exist" + % ("s" if len(bogus) > 1 else "", + "', '".join(bogus), + "do" if len(bogus) > 1 else "does")) + + check_args_section(self.args, self.info, 'members') + check_args_section(self.features, self.info, 'features') diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index bdea9482fc..cf0045f34e 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -56,6 +56,8 @@ class QAPISchemaEntity(object): seen =3D {} for f in self.features: f.check_clash(self.info, seen) + if self.doc: + self.doc.connect_feature(f) =20 self._checked =3D True =20 diff --git a/tests/qapi-schema/doc-bad-feature.err b/tests/qapi-schema/doc-= bad-feature.err index e69de29bb2..e4c62adfa3 100644 --- a/tests/qapi-schema/doc-bad-feature.err +++ b/tests/qapi-schema/doc-bad-feature.err @@ -0,0 +1 @@ +doc-bad-feature.json:3: documented member 'a' does not exist diff --git a/tests/qapi-schema/doc-bad-feature.json b/tests/qapi-schema/doc= -bad-feature.json index 2a78e3b1db..3d49b8e607 100644 --- a/tests/qapi-schema/doc-bad-feature.json +++ b/tests/qapi-schema/doc-bad-feature.json @@ -1,5 +1,4 @@ # Features listed in the doc comment must exist in the actual schema -# BUG: nonexistent @a is not rejected =20 ## # @foo: diff --git a/tests/qapi-schema/doc-bad-feature.out b/tests/qapi-schema/doc-= bad-feature.out index fef4a3e400..e69de29bb2 100644 --- a/tests/qapi-schema/doc-bad-feature.out +++ b/tests/qapi-schema/doc-bad-feature.out @@ -1,19 +0,0 @@ -module None -object q_empty -enum QType - prefix QTYPE - member none - member qnull - member qnum - member qstring - member qdict - member qlist - member qbool -module doc-bad-feature.json -command foo None -> None - gen=3DTrue success_response=3DTrue boxed=3DFalse oob=3DFalse preconfig= =3DFalse -doc symbol=3Dfoo - body=3D - - feature=3Da -a diff --git a/tests/qapi-schema/doc-undoc-feature.err b/tests/qapi-schema/do= c-undoc-feature.err index e69de29bb2..62fc82d2b9 100644 --- a/tests/qapi-schema/doc-undoc-feature.err +++ b/tests/qapi-schema/doc-undoc-feature.err @@ -0,0 +1,2 @@ +doc-undoc-feature.json: In command 'foo': +doc-undoc-feature.json:9: feature 'undoc' lacks documentation diff --git a/tests/qapi-schema/doc-undoc-feature.json b/tests/qapi-schema/d= oc-undoc-feature.json index c7650d9974..c52f88e2cd 100644 --- a/tests/qapi-schema/doc-undoc-feature.json +++ b/tests/qapi-schema/doc-undoc-feature.json @@ -1,5 +1,4 @@ # Doc comment must cover all features -# BUG: missing documentation for @undoc not caught =20 ## # @foo: diff --git a/tests/qapi-schema/doc-undoc-feature.out b/tests/qapi-schema/do= c-undoc-feature.out index cdb097361f..e69de29bb2 100644 --- a/tests/qapi-schema/doc-undoc-feature.out +++ b/tests/qapi-schema/doc-undoc-feature.out @@ -1,21 +0,0 @@ -module None -object q_empty -enum QType - prefix QTYPE - member none - member qnull - member qnum - member qstring - member qdict - member qlist - member qbool -module doc-undoc-feature.json -command foo None -> None - gen=3DTrue success_response=3DTrue boxed=3DFalse oob=3DFalse preconfig= =3DFalse - feature undoc - feature doc -doc symbol=3Dfoo - body=3D - - feature=3Ddoc -documented feature --=20 2.21.0