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>
This commit is contained in:
Oliver Steffen 2024-09-30 20:32:40 +02:00 committed by mergify[bot]
parent 29859cbc28
commit 61c714285f

View File

@ -156,7 +156,8 @@ class HostBasedUnitTestRunner(IUefiBuildPlugin):
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