Work around gcov json output bug

When gcov outputs into it's intermediate json format, sometimes it marks blocks as unexecuted but also sets an execution count != 0. In this case, the "count" field is correct, but the "unexecuted_block" field is incorrect.

When outputting lcov formatted coverage data in filtercov.py, only output a branch coverage data lines (BRDA) with a "-" for the "taken" field when both count==0 and unexecuted_block==true in the input gcov json intermediate file.
This commit is contained in:
Paul Bartell
2021-03-30 16:28:07 -07:00
committed by Paul Bartell
parent e39c34ba7e
commit 19271ddc8d

View File

@ -308,7 +308,7 @@ def convert_to_lcov_info(args, covdata, outfile):
# Handle branch data
for target_branch in target_line["branches"]:
branch_count = "-"
if target_line["unexecuted_block"] or target_line["count"] == 0:
if target_line["unexecuted_block"] and target_line["count"] == 0:
branch_count = "-"
elif "count" in target_branch:
branch_count = target_branch["count"]