From nobody Thu Aug 27 00:01:44 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1781151872; cv=none; d=zohomail.com; s=zohoarc; b=kgAA5nqaDwSsYX0GfmJ78EA8wHlsOz1dNaVIdbtNxgPyznCsqu/LyCpRfZbuk3reAb6+ploCGJa+bX57eMK+v5J/rx6NLF+miix2DsIS6lJ8agia7b84nbHubjurGxA8IaNVnT1BsjxBJVK1HLkOIWTjmNG7llyeAC3fmLb6qU4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1781151872; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=D39Y81M9rFkACn/NQlcX7QZiwh/aJXxhvafRYIbxpe8=; b=U3c79G+aE8GB/d5HJloI36ykVi4JbOscymeNV3aXUChrwTrDadp7ciiasm+/eHKV3bKWWgeBxmtBiYqcEpy72dclUd9VStJIw9ZExgOKw8ectrSWu2mv5PsXq+QdGJ1EsWV6M/qUF6VuGaEIIc63QRlQoXPbrd2ZZEnZONEpaeE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1781151872509555.6444970623726; Wed, 10 Jun 2026 21:24:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wXWxW-0004fF-AZ; Thu, 11 Jun 2026 00:24:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wXWxT-0004es-VW for qemu-devel@nongnu.org; Thu, 11 Jun 2026 00:24:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wXWxS-0005S6-Dm for qemu-devel@nongnu.org; Thu, 11 Jun 2026 00:23:59 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-374-oU9FRwM3Nu-B7Clb7eSPKg-1; Thu, 11 Jun 2026 00:23:52 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CB31C1955EAC; Thu, 11 Jun 2026 04:23:50 +0000 (UTC) Received: from jsnow-thinkpadp16vgen1.westford.csb (unknown [10.22.80.2]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id AEF3C1800583; Thu, 11 Jun 2026 04:23:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1781151837; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=D39Y81M9rFkACn/NQlcX7QZiwh/aJXxhvafRYIbxpe8=; b=e+hTLWe5j0j4OdFzPk66c+hCusQvuBOers0DKDs/VIF6fKacDBDHiCtTGinMyGQ2FmGdKa vuOFznnq9R+MoRS+pETQ1p2bLvy08RH8PebC7+56CFYBPSKPVXfj+M+rCEOzhVzcY0Rq/+ fjxruC3uM6+9hwFj0/f0KlzINrjYk9k= X-MC-Unique: oU9FRwM3Nu-B7Clb7eSPKg-1 X-Mimecast-MFC-AGG-ID: oU9FRwM3Nu-B7Clb7eSPKg_1781151831 From: John Snow To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Michael Roth , Eric Blake , "Michael S. Tsirkin" , Markus Armbruster , linux-edac@vger.kernel.org, John Snow , Gerd Hoffmann , Mauro Carvalho Chehab , Pierrick Bouvier , Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Paolo Bonzini , Ani Sinha , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Cleber Rosa , Peter Maydell , Richard Henderson Subject: [PATCH v4 02/13] tests/qapi: generate output in source order Date: Thu, 11 Jun 2026 00:23:21 -0400 Message-ID: <20260611042332.482979-3-jsnow@redhat.com> In-Reply-To: <20260611042332.482979-1-jsnow@redhat.com> References: <20260611042332.482979-1-jsnow@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 8 X-Spam_score: 0.8 X-Spam_bar: / X-Spam_report: (0.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1781151875049158500 Content-Type: text/plain; charset="utf-8" Rewrite the test doc generator to produce output in source order instead of arbitrarily by section name. This patch removes our last use of the "body" field, which has an effect on how the sections of each test documention block are printed. We now print the name of the section followed by the section text for all sections except Members and Features, which are printed as "Member=3D%s" or "Feature=3D%s" followed by the section text, respectively. This patch is motivated by a desire to move the QAPIDoc API away from named fields for specific sections in a bid to force all users to simply iterate through all_sections in order, instead - and to remove the named subsections. Signed-off-by: John Snow --- tests/qapi-schema/doc-good.out | 82 +++++++++++++++++----------------- tests/qapi-schema/test-qapi.py | 14 +++--- 2 files changed, 48 insertions(+), 48 deletions(-) diff --git a/tests/qapi-schema/doc-good.out b/tests/qapi-schema/doc-good.out index 04a55072646..b9829e2f841 100644 --- a/tests/qapi-schema/doc-good.out +++ b/tests/qapi-schema/doc-good.out @@ -54,15 +54,15 @@ event EVT_BOXED Object boxed=3DTrue feature feat3 doc freeform - body=3D + Plain ******* Section ******* doc freeform - body=3D + Plain Just text, no heading. doc freeform - body=3D + Plain Subsection =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 @@ -106,84 +106,84 @@ Examples: - *verbatim* - {braces} doc symbol=3DEnum - body=3D + Plain =20 - arg=3Done + Member=3Done The _one_ {and only}, description on the same line - arg=3Dtwo + Member=3Dtwo =20 - feature=3Denum-feat + Feature=3Denum-feat Also _one_ {and only} - feature=3Denum-member-feat + Feature=3Denum-member-feat a member feature - section=3DPlain + Plain @two is undocumented doc symbol=3DBase - body=3D + Plain =20 - arg=3Dbase1 + Member=3Dbase1 description starts on a new line, minimally indented doc symbol=3DVariant1 - body=3D + Plain A paragraph =20 Another paragraph =20 @var1 is undocumented - arg=3Dvar1 + Member=3Dvar1 =20 - feature=3Dvariant1-feat + Feature=3Dvariant1-feat a feature - feature=3Dmember-feat + Feature=3Dmember-feat a member feature doc symbol=3DVariant2 - body=3D + Plain =20 doc symbol=3DObject - body=3D + Plain =20 - feature=3Dunion-feat1 + Feature=3Dunion-feat1 a feature doc symbol=3DAlternate - body=3D + Plain =20 - arg=3Di + Member=3Di description starts on the same line remainder indented the same @b is undocumented - arg=3Db + Member=3Db =20 - feature=3Dalt-feat + Feature=3Dalt-feat a feature doc freeform - body=3D + Plain Another subsection =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D doc symbol=3Dcmd - body=3D + Plain =20 - arg=3Darg1 + Member=3Darg1 description starts on a new line, indented - arg=3Darg2 + Member=3Darg2 description starts on the same line remainder indented differently - arg=3Darg3 + Member=3Darg3 =20 - feature=3Dcmd-feat1 + Feature=3Dcmd-feat1 a feature - feature=3Dcmd-feat2 + Feature=3Dcmd-feat2 another feature - section=3DPlain + Plain .. note:: @arg3 is undocumented - section=3DReturns + Returns @Object - section=3DErrors + Errors some - section=3DTodo + Todo frobnicate - section=3DPlain + Plain .. admonition:: Notes =20 - Lorem ipsum dolor sit amet @@ -207,23 +207,23 @@ Examples:: =20 Note:: Ceci n'est pas une note - section=3DSince + Since 2.10 doc symbol=3Dcmd-boxed - body=3D + Plain If you're bored enough to read this, go see a video of boxed cats - feature=3Dcmd-feat1 + Feature=3Dcmd-feat1 a feature - feature=3Dcmd-feat2 + Feature=3Dcmd-feat2 another feature - section=3DPlain + Plain .. qmp-example:: =20 -> "this example" =20 <- ... has no title ... doc symbol=3DEVT_BOXED - body=3D + Plain =20 - feature=3Dfeat3 + Feature=3Dfeat3 a feature diff --git a/tests/qapi-schema/test-qapi.py b/tests/qapi-schema/test-qapi.py index cf7fb8a6df5..5beb96e894f 100755 --- a/tests/qapi-schema/test-qapi.py +++ b/tests/qapi-schema/test-qapi.py @@ -19,6 +19,7 @@ from io import StringIO =20 from qapi.error import QAPIError +from qapi.parser import QAPIDoc from qapi.schema import QAPISchema, QAPISchemaVisitor =20 =20 @@ -116,13 +117,12 @@ def test_frontend(fname): print('doc symbol=3D%s' % doc.symbol) else: print('doc freeform') - 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.kind, section.text)) + for section in doc.all_sections: + if isinstance(section, QAPIDoc.ArgSection): + print(' %s=3D%s' % (section.kind, section.name)) + else: + print(' %s' % section.kind) + print(section.text) =20 =20 def open_test_result(dir_name, file_name, update): --=20 2.54.0