From ea200a80b412921952d923ced671f6087abc8350 Mon Sep 17 00:00:00 2001 From: Oliver Steffen Date: Mon, 30 Sep 2024 20:32:40 +0200 Subject: [PATCH] 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 --- .../Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py index 31d13b2ee7782..9fb8a19c6da23 100644 --- a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py +++ b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py @@ -156,7 +156,8 @@ def gen_code_coverage_gcc(self, thebuilder): return 1 # Coverage data for tested files only - ret = RunCmd("lcov", f"--capture --directory {buildOutputBase}/ --output-file {buildOutputBase}/coverage-test.info --rc lcov_branch_coverage=1") + # `--ignore-errors mismatch` needed to make lcov v2.0+/gcov work. + ret = RunCmd("lcov", f"--capture --directory {buildOutputBase}/ --output-file {buildOutputBase}/coverage-test.info --rc lcov_branch_coverage=1 --ignore-errors mismatch") if ret != 0: logging.error("UnitTest Coverage: Failed to build coverage data for tested files.") return 1