49 Commits

Author SHA1 Message Date
Mike Beaton
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 Kinney
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 Kinney
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
Daniel
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 Kinney
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 Kinney
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 Lai
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 Kinney
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-Denny
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 Kinney
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 A
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 Lin
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 Kubacki
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 Kinney
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 Gryanko
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 Steffen
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 Steffen
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 Attar
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-Denny
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 Vagedes
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 Kubacki
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 Kubacki
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
Michael Kubacki
1bb9f47739 BaseTools/CodeQL: Removed unused static function query
This query seems to produce a rate of false positives with some
common patterns in edk2 like passing function pointers for callback.

Due to the usage of `STATIC` instead of `static` particularly for
functions, this query was rarely used in the past. It is removed
here to prevent future false positives.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2024-07-16 04:04:33 +00:00
v-bhavanisu
8e6ba0dcae BaseTools/HostBasedUnitTestRunner: Promote Unittest error to CI fail.
Some unit tests would fail to execute or execute and not produce any output
logs. In these cases, the only output would be in the CI Log as
`UnitTest Execution Error`.

A UnitTest Execution Error should be considered the same as a unit tests
test failing.

Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
2024-07-15 16:50:00 +00:00
Leif Lindholm
426b69830e BaseTools: change non-ASCII characters in LinuxGcc5ToolChain.py
Commit ea56fa3d47 ("BaseTools: Enable RISC-V architecture for RISC-V
EDK2 CI") introduced a UTF-8 NBSP (0xc2a0) inside a comment block
otherwise copied identically from pre-existing architectures.
This was clearly unintentional and confuses things when looking for
which files contain UTF-8 encodings, so change it to good old 0x20.

Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
2024-07-09 13:38:55 +00:00