From 19271ddc8dc79d52a812a070d1687f3d801bed19 Mon Sep 17 00:00:00 2001 From: Paul Bartell Date: Tue, 30 Mar 2021 16:28:07 -0700 Subject: 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. --- FreeRTOS/Test/CMock/tools/filtercov.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FreeRTOS/Test/CMock/tools/filtercov.py b/FreeRTOS/Test/CMock/tools/filtercov.py index 35a58c16e..62ffed3a9 100755 --- a/FreeRTOS/Test/CMock/tools/filtercov.py +++ b/FreeRTOS/Test/CMock/tools/filtercov.py @@ -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"] -- cgit v1.2.1