From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id AD32B941B52 for ; Mon, 14 Aug 2023 20:49:43 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=HH2RelD3nprNCHpzIL3xtoekNBY7WoFixDs8id5JEkk=; c=relaxed/simple; d=groups.io; h=DKIM-Filter:From:To:Cc:Subject:Date:Message-ID:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1692046182; v=1; b=YXB/5oLTBHbSgltQIojPcDUT3exrD7yocFIcpAuGuXn1EW8oPyM6KR9kT3pc10Dw1Mov0+X2 FuGNc/yvocPYaXNH0WZ/nKED+7JtyCPwPnDQrmoeHescduOkziyQbqe97mhcHkJEgCTAotq7ewi zl+Pi48CHAepoDeetaUQpyWw= X-Received: by 127.0.0.2 with SMTP id 6EejYY7687511xicrdYuXcrn; Mon, 14 Aug 2023 13:49:42 -0700 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web11.119100.1692046176613381630 for ; Mon, 14 Aug 2023 13:49:36 -0700 X-Received: from localhost.localdomain (unknown [47.201.241.95]) by linux.microsoft.com (Postfix) with ESMTPSA id 3ECA62106720; Mon, 14 Aug 2023 13:49:34 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 3ECA62106720 From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Abner Chang , Alexei Fedorov , Ard Biesheuvel , Gerd Hoffmann , Igor Kulchytskyy , Jian J Wang , Jiewen Yao , Jordan Justen , Leif Lindholm , Liming Gao , Michael D Kinney , Nickle Wang , Pierre Gondois , Sami Mujawar , Sean Brogan Subject: [edk2-devel] [PATCH v1 0/7] Add DebugMacroCheck Date: Mon, 14 Aug 2023 16:48:51 -0400 Message-ID: <20230814204859.257-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,mikuback@linux.microsoft.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: itc8hKVoJ3xRgiyk3XYHE8bCx7686176AA= Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b="YXB/5oLT"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=linux.microsoft.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io From: Michael Kubacki Adds a new script and build plugin called DebugMacroCheck. The script verifies that the number of print specifiers match the number of arguments in DEBUG() calls. Overview: - Build plugin: BuildPlugin/DebugMacroCheckBuildPlugin.py - Runs on any build target that is not NO-TARGET - Standalone script: DebugMacroCheck.py - Run `DebugMacroCheck.py --help` to see command line options - Unit tests: - Tests/test_DebugMacroCheck.py - Can be run with: `python -m unittest discover -s ./.pytool/Plugin/DebugMacroCheck/test= s -v` - Also visible in VS Code Test Explorer Background: The tool has been constantly run against edk2 derived code for about a year now. During that time, its found over 20 issues in edk2, over 50 issues in various vendor code, and numerous other issues specific to Project Mu. See the following series for a batch of issues previously fixed in edk2 discovered by the tool: https://edk2.groups.io/g/devel/message/93104 I've received interest from vendors to place it in edk2 to immediately find issues in the upstream and make it easier for edk2 consumers to directly acquire it. That led to this patch series. This would run in edk2 as a build plugin. All issues in the edk2 codebase have been resolved so this would find new issues before they are merged into the codebase. The script is meant to be portable so it can be run as a build plugin or dropped as a standalone script into other environments alongside the unit tests. Series Overview: - Fixes outstanding issues in RedfishPkg - Adds the `regex` PIP module to pip-requirements.txt - Adds exceptions for debug macro usage in ArmVirtPkg, DynamicTablesPkg, and SecurityPkg - Disables the plugin in OvmfPkg per maintainer's previous preferences - Adds the plugin The plugin (this series) is running with passing CI results as shown in this PR: https://github.com/tianocore/edk2/pull/4736 Cc: Abner Chang Cc: Alexei Fedorov Cc: Ard Biesheuvel Cc: Gerd Hoffmann Cc: Igor Kulchytskyy Cc: Jian J Wang Cc: Jiewen Yao Cc: Jordan Justen Cc: Leif Lindholm Cc: Liming Gao Cc: Michael D Kinney Cc: Nickle Wang Cc: Pierre Gondois Cc: Sami Mujawar Cc: Sean Brogan Michael Kubacki (7): RedfishPkg/PlatformHostInterfaceBmcUsbNicLib: Fix DEBUG macro args pip-requirements.txt: Add regex SecurityPkg.ci.yaml: Add debug macro exception ArmVirtPkg.ci.yaml: Add debug macro exception DynamicTablesPkg.ci.yaml: Add debug macro exception OvmfPkg/PlatformCI: Disable DebugMacroCheck .pytool/Plugin: Add DebugMacroCheck RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfa= ceBmcUsbNicLib.c | 8 +- .pytool/Plugin/DebugMacroCheck/BuildPlugin/DebugMacroCheckBuildPlugin.py= | 127 +++ .pytool/Plugin/DebugMacroCheck/BuildPlugin/DebugMacroCheck_plug_in.yaml = | 11 + .pytool/Plugin/DebugMacroCheck/DebugMacroCheck.py = | 859 ++++++++++++++++++++ .pytool/Plugin/DebugMacroCheck/Readme.md = | 253 ++++++ .pytool/Plugin/DebugMacroCheck/tests/DebugMacroDataSet.py = | 674 +++++++++++++++ .pytool/Plugin/DebugMacroCheck/tests/MacroTest.py = | 131 +++ .pytool/Plugin/DebugMacroCheck/tests/__init__.py = | 0 .pytool/Plugin/DebugMacroCheck/tests/test_DebugMacroCheck.py = | 201 +++++ ArmVirtPkg/ArmVirtPkg.ci.yaml = | 8 + DynamicTablesPkg/DynamicTablesPkg.ci.yaml = | 8 + OvmfPkg/PlatformCI/PlatformBuildLib.py = | 1 + SecurityPkg/SecurityPkg.ci.yaml = | 9 + pip-requirements.txt = | 2 +- 14 files changed, 2287 insertions(+), 5 deletions(-) create mode 100644 .pytool/Plugin/DebugMacroCheck/BuildPlugin/DebugMacro= CheckBuildPlugin.py create mode 100644 .pytool/Plugin/DebugMacroCheck/BuildPlugin/DebugMacro= Check_plug_in.yaml create mode 100644 .pytool/Plugin/DebugMacroCheck/DebugMacroCheck.py create mode 100644 .pytool/Plugin/DebugMacroCheck/Readme.md create mode 100644 .pytool/Plugin/DebugMacroCheck/tests/DebugMacroDataSe= t.py create mode 100644 .pytool/Plugin/DebugMacroCheck/tests/MacroTest.py create mode 100644 .pytool/Plugin/DebugMacroCheck/tests/__init__.py create mode 100644 .pytool/Plugin/DebugMacroCheck/tests/test_DebugMacroC= heck.py --=20 2.41.0.windows.3 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#107735): https://edk2.groups.io/g/devel/message/107735 Mute This Topic: https://groups.io/mt/100745693/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-