fastcov icon indicating copy to clipboard operation
fastcov copied to clipboard

Generating diff report failed when processing .info file.

Open bluedevils23 opened this issue 1 year ago • 1 comments

fastcov.py didn't handle BRDA line correctly when processing .info file.

bash-3.2$ python3 /usr/local/lib/python3.9/site-packages/fastcov.py -C ./merge-all.info --diff-filter rb1931120.patch --lcov -o merge-all-patch.info [0.010s] [info]: Performing combine operation Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/fastcov.py", line 1004, in main() File "/usr/local/lib/python3.9/site-packages/fastcov.py", line 975, in main fastcov_json = getCombineCoverage(args) File "/usr/local/lib/python3.9/site-packages/fastcov.py", line 807, in getCombineCoverage fastcov_json = parseAndCombine(args.combine) File "/usr/local/lib/python3.9/site-packages/fastcov.py", line 787, in parseAndCombine report = parseInfo(path) File "/usr/local/lib/python3.9/site-packages/fastcov.py", line 768, in parseInfo current_data["branches"][line_num].append(int(count)) ValueError: invalid literal for int() with base 10: '-'

bash-3.2$ cat merge-all.info 417 BRDA:106,0,1,0 418 BRDA:133,0,0,- 419 BRDA:133,0,1,- 420 BRDA:166,0,0,- 421 BRDA:166,0,1,- 422 BRDA:171,0,0,- 423 BRDA:171,0,1,- 424 BRDA:171,1,2,- 425 BRDA:171,1,3,- 426 BRDA:175,0,0,- 427 BRDA:175,0,1,-

According to https://manpages.debian.org/stretch/lcov/geninfo.1.en.html

BRDA: line number,block number,branch number,taken

Block number and branch number are gcc internal IDs for the branch. Taken is either '-' if the basic block containing the branch was never executed or a number indicating how often that branch was taken.

bluedevils23 avatar Sep 23 '22 07:09 bluedevils23

Thanks for the report. PR welcome if you would like this fixed quickly, otherwise I'll get around to it eventually.

RPGillespie6 avatar Sep 23 '22 21:09 RPGillespie6