summaryrefslogtreecommitdiff
path: root/BaseTools/Plugin
AgeCommit message (Collapse)AuthorFilesLines
2023-11-07BaseTools/Plugin/CodeQL: Enable 30 queriesMichael Kubacki1-7/+50
Updates the CodeQL queries opted into by edk2 to a set of queries from the standard CodeQL query package `codeql/cpp-queries`. After testing a large number of queries the included set here were found to be the most useful with the least number of false positives. Some queries had a number of issues that led to them being placed on the exclusion list so that they are not considered in the future without the notes there being taken into account. General details about queries available in the pack are available here: https://codeql.github.com/codeql-query-help/cpp/ The issues found by these queries will need to be fixed over time. In the meantime, the results will show to those that have permission in the repo's GitHub Code Scanning area. The build will not fail due to CodeQL issues (since they are not all fixed) but that can be enabled in the future. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Rebecca Cran <rebecca@bsdio.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Sean Brogan <sean.brogan@microsoft.com> Acked-by: Laszlo Ersek <lersek@redhat.com> Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
2023-11-07BaseTools/Plugin/CodeQL: Add integration helpersMichael Kubacki2-0/+79
Adds a Python module to the CodeQL plugin directory that exports functions commonly needed for Stuart-based platforms to easily enable CodeQL in their platform build. This functionality has already moved to edk2-pytool-extensions https://github.com/tianocore/edk2-pytool-extensions in the `edk2toolext/codeql.py` file but edk2 is too far behind to use that. Additional integration changes are needed in edk2 and the series to add those has not made it past review. In the meantime, the functions are available locally in this commit and this commit can be reverted after edk2-pytool-extensions 0.24.1 or greater is used in edk2. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Rebecca Cran <rebecca@bsdio.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Sean Brogan <sean.brogan@microsoft.com> Acked-by: Laszlo Ersek <lersek@redhat.com> Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
2023-11-07BaseTools/Plugin/CodeQL: Add CodeQL build pluginMichael Kubacki14-0/+1339
Adds a CodeQL plugin that supports CodeQL in the build system. 1. CodeQlBuildPlugin - Generates a CodeQL database for a given build. 2. CodeQlAnalyzePlugin - Analyzes a CodeQL database and interprets results. 3. External dependencies - Assist with downloading the CodeQL CLI and making it available to the CodeQL plugins. 4. CodeQlQueries.qls - A C/C++ CodeQL query set run against the code. 5. Readme.md - A comprehensive readme file to help: - Platform integrators understand how to configure the plugin - Developers understand how to modify the plugin - Users understand how to use the plugin Read Readme.md for additional details. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Rebecca Cran <rebecca@bsdio.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Yuwei Chen <yuwei.chen@intel.com> Reviewed-by: Sean Brogan <sean.brogan@microsoft.com> Acked-by: Laszlo Ersek <lersek@redhat.com> Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
2023-10-28BaseTools: Plugin: Integration of edk2-pytoolsJoey Vagedes1-5/+5
Performs Integration instructions necessary to upgrade edk2-pytool-library to 0.19.3 and edk2-pytool-extensions to 0.25.1. This includes resolving the deprecation of builder.mws and replacing it with builder.edk2path functionality. Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Michael Kubacki <mikuback@linux.microsoft.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Joey Vagedes <joeyvagedes@gmail.com> Message-Id: <20231027151551.1043941-3-joeyvagedes@microsoft.com> Reviewed-by: Rebecca Cran <rebecca@os.amperecomputing.com> Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com>
2023-09-19BaseTools/Plugin: Add DebugMacroCheckMichael Kubacki8-0/+2256
Adds a plugin that finds debug macro formatting issues. These errors often creep into debug prints in error conditions not frequently executed and make debug more difficult when they are encountered. The code can be as a standalone script which is useful to find problems in a large codebase that has not been checked before or as a build plugin that notifies a developer of an error right away. The script was already used to find numerous issues in edk2 in the past so there's not many code fixes in this change. More details are available in the readme file: .pytool\Plugin\DebugMacroCheck\Readme.md Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Rebecca Cran <rebecca@bsdio.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2023-05-11BaseTools/Plugin: Too many execute files cause "cmd too long" failureGua Guo1-5/+41
Windows command prompt have 8191 characters limitation, enhance it to make command too long can be resloved. Provide an example, if have too many cov files, it causes to run single command over the 8191 characters limitation. > OpenCppCoverage > --export_type binary:coverage.cov > --working_dir={workspace}Build > --input_coverage=AAA.cov > ... > --input_coverage=NNN.cov The solution is passing many coverage files in single command line to breaking it up into many command lines with one coverage file per command line in order to prevent single line is over to 8191 characters. - Command Line 1 > OpenCppCoverage > --export_type binary:coverage.cov > --working_dir={workspace}Build > --input_coverage=AAA.cov > --input_coverage=coverage.cov ... - Command Line N > OpenCppCoverage > --export_type. binary:coverage.cov > --working_dir={workspace}Build > --input_coverage=NNN.cov > --input_coverage=coverage.cov Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Michael Kubacki <mikuback@linux.microsoft.com> Cc: Rebecca Cran <rebecca@bsdio.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Gua Guo <gua.guo@intel.com> Reviewed-by: Michael Kubacki <mikuback@linux.microsoft.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2023-04-27BaseTools/Plugin: Report error if code coverage failureGua Guo1-2/+6
If code coverage exist failure, CI/CD need to catch it Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Michael Kubacki <mikuback@linux.microsoft.com> Signed-off-by: Gua Guo <gua.guo@intel.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Michael Kubacki <mikuback@linux.microsoft.com>
2023-04-20BaseTools/Plugin: Clarify code coverage failure messageMichael Kubacki1-0/+13
HostBasedUnitTestRunner.py is a build plugin responsible for locating and executing host-based unit tests. Recently, commit 6bb00aa introduced support for the plugin to generate code coverage reports via lcov and OpenCppCoverage. The plugin has discovered unit tests by searching for executables with "Test" in the name for a while. However, the test coverage change makes assumptions about test presence when crafting the OpenCppCoverage command that ultimately fails with an ambiguous error message if no host-based unit tests are discovered (see "ERROR"). ``` SECTION - Run Host based Unit Tests SUBSECTION - Testing for architecture: X64 ERROR - UnitTest Coverage: Failed to generate cobertura format xml in single package. PROGRESS - --->Test Success: Host Unit Test Compiler Plugin NOOPT ``` This change preempts that message with a check in the plugin to determine if any host-based tests were discovered. If not, a message is printed with more guidance about how the developer should proceed to either (1) fix their tests so code coverage is generated as expected or (2) prevent the error message. New message: ``` SECTION - Run Host based Unit Tests SUBSECTION - Testing for architecture: X64 WARNING - UnitTest Coverage: No unit tests discovered. Test coverage will not be generated. Prevent this message by: 1. Adding host-based unit tests to this package 2. Ensuring tests have the word "Test" in their name 3. Disabling HostUnitTestCompilerPlugin in the package CI YAML file PROGRESS - --->Test Success: Host Unit Test Compiler Plugin NOOPT ``` Cc: Rebecca Cran <rebecca@bsdio.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Yuwei Chen <yuwei.chen@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
2023-02-16BaseTools: Update WindowsVsToolChain pluginJoey Vagedes1-4/+12
This patch updates edk2-pytool-library dependency to v0.14.0, which has an interface change to FindWithVsWhere. The BaseTools plugin uses this function, so it is being updated to account for the interface change. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Joey Vagedes <joeyvagedes@microsoft.com> Acked-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2023-01-04BaseTools/Plugin: Add coverage support for Unit TestGua Guo1-1/+100
For GCC, use lcov to generate Unit Test code coverage report For VS2019, use OpenCppCoverage to generate code coverage report Cc: Bob Feng <bob.c.feng@intel.com> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com> Cc: Liming Gao <gaoliming@bysoft.com.cn> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Reviewed-by: Michael Kubacki <mikuback@linux.microsoft.com> Signed-off-by: Gua Guo <gua.guo@intel.com>
2022-11-11BaseTools/Plugin/HostBaseUnitTestRunner: Enable gtest xml outputMichael D Kinney1-2/+5
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4134 Set environment variable GTEST_OUTPUT to specify the output format of XML and the output file name. Both CMOCKA_XML_FILE and GTEST_OUTPUT are set for each host based unit test to support both cmocka unit tests and gtest unit tests. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
2022-10-14BaseTools: Enable LoongArch64 architecture for LoongArch64 EDK2 CI.Chao Li1-0/+31
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4053 EDK CI for LoongArch64 architecture Enable LoongArch64 architecture for LoongArch64 EDK2 CI testing. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Chao Li <lichao@loongson.cn> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2021-09-29BaseTools: Switch to downloading the AARCH64 compiler from Arm's siteRebecca Cran1-1/+1
Linaro no longer do gcc releases - they're done by Arm now. Update gcc_aarch64_linux_ext_dep.yaml to fetch the latest AARCH64 gcc release (10.3-2021.07) from their site and fix LinuxGcc5ToolChain.py with the new GCC_AARCH64_PREFIX. Signed-off-by: Rebecca Cran <rebecca@bsdio.com> Acked-by: Leif Lindholm <leif@nuviainc.com> Acked-by: Liming Gao <gaoliming@byosoft.com.cn> Acked-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Pierre Gondois <Pierre.Gondois@arm.com> Acked-by: Bob Feng <bob.c.feng@intel.com>
2021-09-29BaseTools: Switch to downloading the ARM compiler from Arm's siteRebecca Cran1-1/+1
Linaro no longer do gcc releases - they're done by Arm now. Update gcc_arm_linux_ext_dep.yaml to fetch the latest ARM gcc release (10.3-2021.07) from their site and fix LinuxGcc5ToolChain.py with the new GCC_ARM_PREFIX. Signed-off-by: Rebecca Cran <rebecca@bsdio.com> Acked-by: Leif Lindholm <leif@nuviainc.com> Acked-by: Liming Gao <gaoliming@byosoft.com.cn> Acked-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Pierre Gondois <Pierre.Gondois@arm.com> Acked-by: Bob Feng <bob.c.feng@intel.com>
2020-05-08BaseTools/Plugin: Update HostBasedUnitTestRunner to support LinuxSean Brogan2-31/+31
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2513 Update HostBasedUnitTestRunner plugin to support the Linux environment and remove any Windows only logic. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Sean Brogan <sean.brogan@microsoft.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2020-05-07BaseTools: Enable RISC-V architecture for RISC-V EDK2 CI.Abner Chang1-0/+38
BZ:2562: https://bugzilla.tianocore.org/show_bug.cgi?id=2562 EDK CI for RISC-V architecture Enable RISC-V architecture for RISC-V EDK2 CI testing. Signed-off-by: Abner Chang <abner.chang@hpe.com> Reviewed-by: Sean Brogan <sean.brogan@microsoft.com> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Gilbert Chen <gilbert.chen@hpe.com> Cc: Daniel Helmut Schaefer <daniel.schaefer@hpe.com>
2020-04-13BaseTools/WindowsVsToolChain.py: Update toolchain pluginShenglei Zhang1-11/+62
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2659 Allow WindowsVsToolChain Plugin to add libraries and headers of user defined ARCH for VS2017 and VS2019. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com>
2020-02-07BaseTools/Plugin: Add HostBasedUnitTestRunner pluginMichael D Kinney2-0/+127
https://bugzilla.tianocore.org/show_bug.cgi?id=2505 Add plugin to BaseTools to run host based unit tests. Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Bret Barkelew <Bret.Barkelew@microsoft.com> Acked-by: Bob Feng <bob.c.feng@intel.com>
2020-02-07BaseTools/WindowsVsToolChain: Setup VS2017/VS2019 envSean Brogan1-0/+23
https://bugzilla.tianocore.org/show_bug.cgi?id=2495 Update the WindowsVsToolChain plugin to setup the VS2017 or VS2019 development environment. This is required to build BaseTools and Structured PCD host applications. Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
2020-02-07BaseTools/WindowsVsToolChain: Clean up Python source formattingSean Brogan1-19/+26
https://bugzilla.tianocore.org/show_bug.cgi?id=2495 Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
2019-11-11BaseTools: Add BaseTools plugins to support CISean Brogan9-0/+483
https://bugzilla.tianocore.org/show_bug.cgi?id=2315 Add the following plugins that are required to support EDK II Continuous Integration (CI) builds. These plugins are added to BaseTools because that support EDK II BaseTools features. * BuildToolsReportGenerator * LinuxGcc5ToolChain * WindowsResourceCompiler * WindowsVsToolChain Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>