Commit Graph
52 Commits
Author SHA1 Message Date
Aaron Popandmergify[bot] b7cf7e465c BaseTools: Only check for GCC prefixes when targeting
LinuxGccToolChain is checking for the environment variable
GCC_AARCH64_PREFIX when GCC_AARCH64_INSTALL is set in the environment
variables. GCC_AARCH64_INSTALL is set when any gcc aarch64 compiler
is installed (i.e. aarch64-none-elf, aarch64-linux-gnu, aarch64-unknown-elf
all result in a GCC_AARCH64_INSTALL environment variable).

When compiling for an X86 target, if an AARCH64 tool chain is installed
in the system, this will result in an error due to the GCC_AARCH64_PREFIX
not being set.

Add a check based upon TARGET_ARCH and and only verify the prefixes
when attempting to build AARCH64.

Replicate the same check for RISCV and LOONGARCH64 architectures as well.

Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
2026-04-03 05:32:14 +00:00
Doug Flickandmergify[bot] 233eddb8e3 BaseTools/Plugin: Add lcov error tolerance for vendored source trees
lcov v2.0+ treats several gcov/source-related conditions as fatal
errors that were previously warnings in v1.x. This causes coverage
capture to abort when the build tree includes vendored third-party
sources (e.g. OpenSSL) that produce gcov mismatches, missing source
references, unexpected gcov output, or non-zero gcov return codes.

Signed-off-by: Doug Flick <dougflick@microsoft.com>
2026-03-31 22:24:43 +00:00
Mike Beatonandmergify[bot] 4057d2959c BaseTools/WindowsVsToolChain.py: Minor code style updates
Fixes: 0b867b65a2

Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
2026-03-07 18:30:01 +00:00
Mike Beatonandmergify[bot] 2afee514d7 BaseTools: Remove GCC5 support from LinuxGccToolChain.py
Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
2026-02-26 15:30:52 +00:00
Michael D Kinneyandmergify[bot] ea011c812f BaseTools/Plugin/WindowsVsToolChain: Add WindowsSDKLibVersion
Fix VS20xx build failures in GitHub Actions windows-2025
environments due to missing libraries.

Add WindowsSDKLibVersion to the set of environment variables
that are set in a Windows Visual Studio build environment.

WindowsSDKLibVersion is required to set LIBPATH for VS20xx
builds of the EmulatorPkg and Host-based unit tests.

Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
2026-01-29 01:03:38 +00:00
Michael D Kinneyandmergify[bot] 0b867b65a2 BaseTools/Plugin/WindowsVsToolChain: CLANGPDB add IA32 DLLs to Path
Add %VCToolsInstallDir%\bin\Hostx64\x86 to PATH to add DLLs
required for IA32 host-based unit tests to execute.

Some Visual Studio environments add the IA32 DLL path to PATH
and some do not. The failure was observed in GitHub Action
windows-2025 agents where the X64 DLL path was added, but the
IA32 DLL path was missing.

Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
2026-01-29 01:03:38 +00:00
Danielandmergify[bot] 52d54e0b44 BaseTools: Add VS2026 support.
Adding tools_def for VS2026.
Update WindowsVsToolChain to support VS2026.
Update set_vsPrefix_envs and toolsetup and edksetup to support VS2026.

Signed-off-by: Daniel Grobert <danalexgro@gmail.com>
2026-01-07 20:19:12 +00:00
Michael D Kinneyandmergify[bot] 923a951e8a BaseTools/Plugin/HostBasedUnitTestRunner: Add missing quotes for Windows
Add missing double quotes for lcov_cobertura --excludes option.

Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
2026-01-06 20:52:29 +00:00
Michael D Kinneyandmergify[bot] 0f59a2a287 BaseTools/WindowsVsToolChain: Add CLANG support
Add logic to detect CLANG environments and set the
required environment variables.

The CLANGPDB tool chain tag in Windows environments can
be used with Visual Studio compiler or Mingw CLANG
compiler. Add detection of Mingw CLANG compiler first
and if Mingw not detected, then use the existing logic
for using Visual Studio.

The CLANGDWARF tool chain tag in Windows environments
can only be used with Mingw CLANG compiler. Add detection
of Mingw CLANG compiler first and if Mingw not detected,
then fail with an error.

Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
2026-01-06 18:22:57 +00:00
Cosmo Laiandmergify[bot] 9e1a3bb474 BaseTools/Plugin/HostBasedUnitTestRunner: Merge clang coverage files
For clang build, enable to generate coverage file under Build folder to
merge coverage files of all module.

Signed-off-by: Cosmo Lai <cosmo.lai@intel.com>
2025-12-22 08:09:04 +00:00
Michael D Kinneyandmergify[bot] 3c454cf7d4 BaseTools/Plugin/HostBasedUnitTestRunner: Add CLANG support
Update HostBasedUnitTestRunner to generate merged Cobertura
coverage.xml output file using CLANG code coverage data
from -fprofile-instr-generate -fcoverage-mapping options.

Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
2025-09-28 23:38:21 +00:00
Oliver Smith-Dennyandmergify[bot] 2ff173af12 BaseTools: Remove ARM32 Support
edk2 is dropping support for the ARM32 architecture. This
commit removes ARM32 code from BaseTools.

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2025-09-25 22:04:10 +00:00
Michael D Kinneyandmergify[bot] 3f278768fa BaseTools/HostBasedUnitTestRunner: lcov ignore mismatch errors
Ignore mismatch errors for lcov 2.x in all locations that lcov
is run. When building more complex unit tests, these mismatch
errors are showing up in different phases of the code coverage
collection.

Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
2025-06-24 19:32:41 +00:00
Roman AandLiming Gao 8809497094 BaseTools: Fix type annotations
Fixed type annotations for functions:
- `def _parse_pattern(line: str) -> Tuple[str]:` -> `def _parse_pattern(line: str) -> Tuple[bool, str, str]:`
- `def get_scopes(codeql_enabled: bool) -> Tuple[str]:` -> `def get_scopes(codeql_enabled: bool) -> Tuple[str, ...]:`

Signed-off-by: Roman A <gameromandev@gmail.com>
2025-05-26 09:02:24 +08:00
Jason1 Linandmergify[bot] 1e0051e293 BaseTools: Fix Debug Macro Checking to Include Scanning Files
- In the commit 42a141800c
  there was a misuse of "is_dir" method.

- Treating it as an object rather than function call,
  which caused if-condition to always as "false".

- No files would be added to scanning list due to incorrect usage.

- This patch corrects the issue by properly using "is_dir()".

Signed-off-by: Jason1 Lin <jason1.lin@intel.com>
2025-03-13 15:39:06 +00:00
Michael Kubackiandmergify[bot] 67df979ad2 DebugMacroCheck: Do not show progress bar with zero items
In the case that the total provided to the `_show_progress()`
function is zero, do not show a progress bar to prevent aborts
`ZeroDivisionError` when calculating the progress percentage.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2025-03-06 15:35:40 +00:00
Michael D Kinneyandmergify[bot] 139cbb266b BaseTools/Plugin/HostBasedUnitTestRunner: Set ASAN env vars
The environment variable `GTEST_CATCH_EXCEPTION` must be
set to `0` for so all exceptions are handled by the
address sanitizer and not GoogleTest. This allows stack
back trace and other details to be logged by the address
sanitizer so the source of the issue identified address
sanitizer can be determined.

The environment variable `ASAN_OPTIONS` must be set to
`detect_leaks=0` to disable memory leak detection. The
unit test frameworks may have memory leaks and some
firmware code under test use cases may perform a memory
allocation without a matching memory free as their
expected behavior.

Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
2025-01-21 05:02:38 +00:00
Alexander Gryankoandmergify[bot] 42a141800c BaseTools: Skip directories with code extensions in the name
Currently openssl has an Open Quantum Safe provider submodule with
directories like oqs-provider/oqs-template/oqsprov/oqsprov.c or
oqs-provider/oqs-template/oqsprov/oqsprov/oqsprov_capabilities.c
that are used as templates, but DebugMacroCheck tries to read them
as a file when recursively traversing the subdirectories.

Fail message:

  File "/usr/lib/python3.10/pathlib.py", line 1119, in open
    return self._accessor.open(self, mode, buffering, encoding, errors,
  IsADirectoryError: [Errno 21] Is a directory: '/CryptoPkg/Library
/OpensslLib/openssl/oqs-provider/oqs-template/oqsprov/oqsprov.c'

Signed-off-by: Alexander Gryanko <xpahos@gmail.com>
2025-01-07 04:56:24 +00:00
Oliver Steffenandmergify[bot] 47ef197873 BaseTools: Coverage: Detect lcov version
Detect the version of lcov and only apply
version 2 workaround when needed.

Fixes 61c714285f

Signed-off-by: Oliver Steffen <osteffen@redhat.com>
2024-12-05 00:05:47 +00:00
Oliver Steffenandmergify[bot] 61c714285f BaseTools: Coverage: make lcov v2.0 work
lcov 2.0 and newer does additional error and consistency checking
compared to previous versions. This can lead to CI jobs failing due to
new/unexpected errors showing up.

See:
- https://edk2.groups.io/g/devel/message/116138
- https://github.com/linux-test-project/lcov/issues/209
- https://github.com/linux-test-project/lcov/issues/238

Signed-off-by: Oliver Steffen <osteffen@redhat.com>
2024-12-04 06:08:05 +00:00
Abdul Lateef Attarandmergify[bot] fd619ec460 BaseTools/CodeQl: Give preference to Plugin settings
For the CodeQl `AuditOnly` flag,
prioritize Plugin settings over global settings.

This patch adjusts the logic for the global `AuditOnly` setting,
placing it before the Plugin setting code.
This ensures that Plugin settings take precedence over global settings.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Joey Vagedes <joey.vagedes@gmail.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
2024-10-09 06:02:34 +00:00
Oliver Smith-Dennyandmergify[bot] 21e1fc5400 BaseTools: LinuxGcc5ToolChain: Run for GCC Toolchain
The GCC5 TOOL_CHAIN_TAG is being deprecated in favor of
GCC. LinuxGcc5ToolChain.py needs to be updated to find
the correct ARM/AARCH64/RISCV/LOONGARCH64 compilers for
the GCC TOOL_CHAIN_TAG, as well, otherwise it defaults
to the system GCC, which is typically X64 based.

In order to keep this backward and forward compatible,
the plugin now checks for the substring "GCC" in the
TOOL_CHAIN_TAG and will set either the "GCC5" or "GCC"
env variables used by tools_def.template to find the
GCC compiler for the requested architecture.

This plugin is also renamed to drop the old GCC5.

Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
2024-09-30 02:19:09 +00:00
Joey Vagedesandmergify[bot] 159f1aee56 BaseTools/WinRcPath: Improve Performance.
WinRcPath generally takes about 2 seconds to run, due to calling
multiple .bat files behind the scenes. This change reduces this time to
~0 seconds due to the following changes:

1. It will attempt to load the path from the cache, which is located a
$(WORKSPACE)/Conf/.rc_path. If the loading is a success and the rc_path
still exists, it will use it.

2. If the cache did not exist, or the path provided by the cache does
not exist, it will find the rc path via the .bat files. If that
succeeds, it will write the path to the cache.

Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
2024-08-04 07:30:59 +00:00
Michael Kubackiandmergify[bot] eed43245df CodeQlQueries.qls: Pin to the 1.1.0 codeq/cpp-queries pack
The codeql/cpp-queries pack used in CodeQlQueries.qls was versioned
1.1.0 for the CodeQL CLI v2.18.1 release currently used.

https://github.com/github/codeql/blob/codeql-cli/v2.18.1/cpp/ql/src/qlpack.yml

This change pins that pack version to prevent the CodeQL CLI and
pack from getting out of sync until explicitly updated.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2024-07-31 23:02:15 +00:00
Michael Kubackiandmergify[bot] 6589843cc6 BaseTools/codeql: Update to CodeQL 2.18.1
Updates to the latest CodeQL version to resolve query dependencies.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2024-07-26 08:17:11 +00:00