我可以使用 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
我只想覆盖 my.patch 但失败了(看起来仍然覆盖所有数据)
不幸的是 lcov --diff 是关于修补源的,以防生成覆盖但源是旧的。 几天前,fastcov 在此 PR 中获得了使用 diff 文件过滤覆盖范围的能力。它尚未发布,但可以使用单文件工具。该工具是为 GCC 9+ 设计的,但如果您只想过滤准备好的 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
@Roman B的回答对我帮助很大。谢谢!