linux 使lcov只捕获部分代码(基于最后N次提交)

8gsdolmq  于 5个月前  发布在  Linux
关注(0)|答案(1)|浏览(55)

我可以使用gcov/lcov/genhtml来生成all the files的测试覆盖率报告,现在我只想获取最近10次提交的报告。我如何才能到达那里?
我尝试的是:

1. compile and run the program. 
2. lcov --directory . --capture --output-file redis.info
3. git diff HEAD~10..HEAD >  my.patch
4. lcov --diff ./redis.info my.patch -o redis-patch.info

字符串
我想为我的覆盖面。补丁只,但失败了(看起来仍然覆盖所有数据)

bsxbgnwa

bsxbgnwa1#

不幸的是,lcov --diff是关于修补源代码的,以防覆盖率被生成,但源代码是旧的。几天前,fastcov在这个PR中获得了使用diff文件过滤覆盖率的能力。它仍然没有发布,但可以使用和一个文件工具。工具是为GCC 9+设计的,但如果你只想过滤ready lcov的.info文件,你可以安全地在任何GCC版本上运行它。用法如下:

1. compile and run the program. 
2. lcov --directory . --capture --output-file redis.info
3. git diff HEAD~10..HEAD >  my.patch
4. python fastcov.py -C ./redis.info --diff-filter my.patch --lcov -o redis-patch.info

字符串

相关问题