summaryrefslogtreecommitdiff
path: root/BaseTools/Plugin
diff options
context:
space:
mode:
Diffstat (limited to 'BaseTools/Plugin')
-rw-r--r--BaseTools/Plugin/CodeQL/analyze/analyze_filter.py6
-rw-r--r--BaseTools/Plugin/CodeQL/integration/stuart_codeql.py2
-rw-r--r--BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py10
3 files changed, 9 insertions, 9 deletions
diff --git a/BaseTools/Plugin/CodeQL/analyze/analyze_filter.py b/BaseTools/Plugin/CodeQL/analyze/analyze_filter.py
index f363dd3..dd9f149 100644
--- a/BaseTools/Plugin/CodeQL/analyze/analyze_filter.py
+++ b/BaseTools/Plugin/CodeQL/analyze/analyze_filter.py
@@ -60,15 +60,15 @@ def _match_path_and_rule(
return result
-def _parse_pattern(line: str) -> Tuple[str]:
+def _parse_pattern(line: str) -> Tuple[bool, str, str]:
"""Parses a given pattern line.
Args:
line (str): The line string that contains the rule.
Returns:
- Tuple[str]: The parsed sign, file pattern, and rule pattern from the
- line.
+ Tuple[bool, str, str]: The parsed sign, file pattern,
+ and rule pattern from the line.
"""
sep_char = ':'
esc_char = '\\'
diff --git a/BaseTools/Plugin/CodeQL/integration/stuart_codeql.py b/BaseTools/Plugin/CodeQL/integration/stuart_codeql.py
index a3941d1..4e1c4d1 100644
--- a/BaseTools/Plugin/CodeQL/integration/stuart_codeql.py
+++ b/BaseTools/Plugin/CodeQL/integration/stuart_codeql.py
@@ -29,7 +29,7 @@ def add_command_line_option(parser: ArgumentParser) -> None:
"BaseTools/Plugin/CodeQL/Readme.md for more info.")
-def get_scopes(codeql_enabled: bool) -> Tuple[str]:
+def get_scopes(codeql_enabled: bool) -> Tuple[str, ...]:
"""Returns the active CodeQL scopes for this build.
Args:
diff --git a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
index c39dae2..91425f1 100644
--- a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
+++ b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
@@ -174,21 +174,21 @@ class HostBasedUnitTestRunner(IUefiBuildPlugin):
logging.info(f"Got lcov version {lcov_version_major}")
# Generate base code coverage for all source files
- ret = RunCmd("lcov", f"--no-external --capture --initial --directory {buildOutputBase} --output-file {buildOutputBase}/cov-base.info --rc lcov_branch_coverage=1")
+ # `--ignore-errors mismatch` needed to make lcov v2.0+/gcov work.
+ lcov_error_settings = "--ignore-errors mismatch" if lcov_version_major >= 2 else ""
+ ret = RunCmd("lcov", f"--no-external --capture --initial --directory {buildOutputBase} --output-file {buildOutputBase}/cov-base.info --rc lcov_branch_coverage=1 {lcov_error_settings}")
if ret != 0:
logging.error("UnitTest Coverage: Failed to build initial coverage data.")
return 1
# Coverage data for tested files only
- # `--ignore-errors mismatch` needed to make lcov v2.0+/gcov work.
- lcov_error_settings = "--ignore-errors mismatch" if lcov_version_major >= 2 else ""
ret = RunCmd("lcov", f"--capture --directory {buildOutputBase}/ --output-file {buildOutputBase}/coverage-test.info --rc lcov_branch_coverage=1 {lcov_error_settings}")
if ret != 0:
logging.error("UnitTest Coverage: Failed to build coverage data for tested files.")
return 1
# Aggregate all coverage data
- ret = RunCmd("lcov", f"--add-tracefile {buildOutputBase}/cov-base.info --add-tracefile {buildOutputBase}/coverage-test.info --output-file {buildOutputBase}/total-coverage.info --rc lcov_branch_coverage=1")
+ ret = RunCmd("lcov", f"--add-tracefile {buildOutputBase}/cov-base.info --add-tracefile {buildOutputBase}/coverage-test.info --output-file {buildOutputBase}/total-coverage.info --rc lcov_branch_coverage=1 {lcov_error_settings}")
if ret != 0:
logging.error("UnitTest Coverage: Failed to aggregate coverage data.")
return 1
@@ -211,7 +211,7 @@ class HostBasedUnitTestRunner(IUefiBuildPlugin):
coverageFile = ""
for testCoverage in testCoverageList:
coverageFile += " --add-tracefile " + testCoverage
- ret = RunCmd("lcov", f"{coverageFile} --output-file {workspace}/Build/all-coverage.info --rc lcov_branch_coverage=1")
+ ret = RunCmd("lcov", f"{coverageFile} --output-file {workspace}/Build/all-coverage.info --rc lcov_branch_coverage=1 {lcov_error_settings}")
if ret != 0:
logging.error("UnitTest Coverage: Failed generate all coverage file.")
return 1