What's the best C++ code coverage tool that works with templates?
I have used gcov for testing code coverage, but when it comes to templated c++ code it doesn't work so well. I use boost::spirit extensively and gcov seems to simply ignore templated spirit code.
Also I am wondering if there is a coverage tool to show how threads interacts with each other, pinpointing the possible branches/race conditions/execution flows actually executed.
TestCocoon is a great tool to try, better than gcov with good tools and report facilities. As templates are compile-time beasts, I'm not sure what coverage information you want to get ?
my two cents
I work on a large product and we used a third party app called BullsEye for coverage testing. It worked wonders.
Our C++ Test Coverage tool provides test coverage on template bodies, or at least those templates that are defined in files you specify for it to cover.
It doesn't distinguish instantiations of templates.
If you have a multi-threaded application, the tool will record the branches executed by all threads, if you configure the tool to use flags that are atomically writable (typically the natural word size of the CPU [32 or 64 bits]. (If you don't do this, you may end up with a thread race in updating the coverage flags and you can lose a bit of coverage. This isn't a defect of the tool; its a consequence of unsynchronized access to the storage holding probe data.)
For race detection, OP needs to find a race detection tool; test coverage tools won't do this.
链接地址: http://www.djcxy.com/p/37966.html上一篇: 覆盖gcov函数以获得执行的代码行
下一篇: 什么是最适合模板的C ++代码覆盖工具?