C++ code coverage tool [closed]
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this questionI am looking for c++ code coverage tool which fares well i开发者_如何转开发n mutli server setup and on both windows and linux without licensing issues(if non free).
I have done some research and found 2 free tools: Covtool and gcov. Any disadvantages on these or any other suggestions?
Although I don't remember all the details of my research for code coverage tools, I seem to remember the following about gcov and covtool:
- They require custom modifications to your build system
- They need custom compiler flags and/or link steps
- They both provide minimal output and formatting
We needed support for Windows/Linux and gcc/MSVC and settled on BullseyeCoverage which is commercial and non-free. We estimated that it would cost us more, in money, to change our build system to use the free products than it would to pay for a BullseyeCoverage license. Their support was great and responsive and I was very pleased with the quality of the tool.
Some benefits:
- Great query support both in command line and GUI form
- Required no changes to our build system
- Had minimal impact on both compile time and run time
- Provides tools to integrate with build bots such as CruiseControl and Hudson
- Nice GUI for visualization and navigation of coverage results
AQTime is popular for Delphi/C++Builder users, but like the other recommendation, it is not free.
use Gcov tool along with LCOV tool. LCOV tool is a graphical front-end for gcov.
The OovAide program is a free open source tool that will instrument source files and generate code coverage statistics as well as show which lines were never run. It is thread safe and efficient.
It is fairly transparent meaning that the code that it produces is all visibile and can be modified for your project if there are special needs required.
The basic idea of the source code modifications is that it inserts a macro at every grouping of statements in the AST that CLang is processing. This is typically after the conditionals or at braces. The macro can be modified, but the default is that it increments a value at an offset in an array. I have also modified it to write to a file in some cases, and this allows a program trace of execution.
One problem may be that its build system is limited, and must be able to be built using CLang. It may not work on certain types of projects. But since it just modifies source code by inserting the macro, it is possible to use it to modify the source code, then use the existing build system to build the modified source code.
There is a document describing how it works here. http://oovaide.sourceforge.net/articles/TestCoverage.html
精彩评论