Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use --add-tracefile option to handle duplicate SF in coverage.info (#…
…3482) What I did use --add-tracefile option in debian/rules and tests/conftest.py to sanitize coverage.info generated by lcov Why I did it lcov generates an initial coverage.info file based on collected .gcno and .gcda files, this .info file contains coverage information for different source files (marked as SF). Sometimes you would observe that the same SF appears multiple times, it means lcov gets multiple copies of coverage information for this file, since this file may have appeared in multiple compilation units, and for each copy, the hit times of its lines are different. Then lcov_cobertura generates coverage.xml based on coverage.info. However, it can't deal with duplicate SF in coverage.info properly. If it sees duplicate coverage information for a source file from coverage.info, it always overwrites the old copy with the new copy, hence only the last copy would be counted. However, if the last copy considers the functions as missing, the function is considered as missing in coverage.xml, which is used to determine whether the new PR passes the coverage threshold. The proper way is to add the hit times of all the copies, which could be achieved by lcov add-tracefile option.
- Loading branch information