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 4E65B740038 for ; Wed, 13 Sep 2023 17:07:25 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=trfYCEyygCa5WWuih94WJBhwi6UoklYeGUloTXGbSAQ=; 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=1694624843; v=1; b=D6Bd79AQ6BYfBySNJ1yYMv3ivI/eYheQwYxSDBu1C7IWPvbIZ2ygQkzAqBEK/kAvEPMTPWtu gpInrCGGDOiSyMEvhZuULb6lIhSywfnPjrhu/4BF7xhJfbFiYUjTSMB9gnSdnuIfN8MphH7738O XE/N5OJk3Sd/38JERv/N5eJw= X-Received: by 127.0.0.2 with SMTP id YPRkYY7687511x4g1H5HQXj7; Wed, 13 Sep 2023 10:07:23 -0700 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web10.2508.1694624843321712737 for ; Wed, 13 Sep 2023 10:07:23 -0700 X-Received: from gem-name-lb-02.localdomain (unknown [47.201.241.95]) by linux.microsoft.com (Postfix) with ESMTPSA id 9061C212BC1B; Wed, 13 Sep 2023 10:07:20 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 9061C212BC1B From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Abner Chang , Alexei Fedorov , Ard Biesheuvel , Bob Feng , Gerd Hoffmann , Igor Kulchytskyy , Jian J Wang , Jiewen Yao , Jordan Justen , Leif Lindholm , Liming Gao , Michael D Kinney , Nickle Wang , Pierre Gondois , Rebecca Cran , Sami Mujawar , Sean Brogan , Yuwei Chen Subject: [edk2-devel] [PATCH v2 0/7] Add DebugMacroCheck Date: Wed, 13 Sep 2023 13:06:08 -0400 Message-ID: <20230913170617.429-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: 6D7VdlckmDpkDpUBXW4kNIL7x7686176AA= 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=D6Bd79AQ; 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 ./BaseTools/Plugin/DebugMacroCheck/te= sts -v` - Also visible in VS Code Test Explorer Note: I've disabled this in some packages due to past maintainer preferences for CI checks. If the patch to disable the plugin does not receive reviews, I will be forced to drop it from the series which means the plugin will be enabled by default in those packages. 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 --- V2 changes: - Move the plugin from .pytool/Plugin to BaseTools/Plugin since it is a build plugin not a CI plugin and that's usually where build plugins reside. - Remove `mws` usage since it has been deprecated recently in edk2-pytools. Cc: Abner Chang Cc: Alexei Fedorov Cc: Ard Biesheuvel Cc: Bob Feng 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: Rebecca Cran Cc: Sami Mujawar Cc: Sean Brogan Cc: Yuwei Chen 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 BaseTools/Plugin: Add DebugMacroCheck RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfa= ceBmcUsbNicLib.c | 8 +- ArmVirtPkg/ArmVirtPkg.ci.yaml = | 8 + BaseTools/Plugin/DebugMacroCheck/BuildPlugin/DebugMacroCheckBuildPlugin.= py | 127 +++ BaseTools/Plugin/DebugMacroCheck/BuildPlugin/DebugMacroCheck_plug_in.yam= l | 11 + BaseTools/Plugin/DebugMacroCheck/DebugMacroCheck.py = | 859 ++++++++++++++++++++ BaseTools/Plugin/DebugMacroCheck/Readme.md = | 253 ++++++ BaseTools/Plugin/DebugMacroCheck/tests/DebugMacroDataSet.py = | 674 +++++++++++++++ BaseTools/Plugin/DebugMacroCheck/tests/MacroTest.py = | 131 +++ BaseTools/Plugin/DebugMacroCheck/tests/__init__.py = | 0 BaseTools/Plugin/DebugMacroCheck/tests/test_DebugMacroCheck.py = | 201 +++++ 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 BaseTools/Plugin/DebugMacroCheck/BuildPlugin/DebugMac= roCheckBuildPlugin.py create mode 100644 BaseTools/Plugin/DebugMacroCheck/BuildPlugin/DebugMac= roCheck_plug_in.yaml create mode 100644 BaseTools/Plugin/DebugMacroCheck/DebugMacroCheck.py create mode 100644 BaseTools/Plugin/DebugMacroCheck/Readme.md create mode 100644 BaseTools/Plugin/DebugMacroCheck/tests/DebugMacroData= Set.py create mode 100644 BaseTools/Plugin/DebugMacroCheck/tests/MacroTest.py create mode 100644 BaseTools/Plugin/DebugMacroCheck/tests/__init__.py create mode 100644 BaseTools/Plugin/DebugMacroCheck/tests/test_DebugMacr= oCheck.py --=20 2.42.0.windows.2 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108600): https://edk2.groups.io/g/devel/message/108600 Mute This Topic: https://groups.io/mt/101341642/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-