Test coverage user interface for C and C++
Here are some screenshots of ggcov in action. Click on the thumbnail images to see larger images.
Information is linked together, e.g. double-clicking on a row in the File List window displays the source for that file in a Source window. Information in tabular form is sortable by any column, and all columns can be selectively shown or hidden.
Coverage summaries for various subsets of the source (All the source, a particular source file, a particular function, a range of lines in a file) are only a few clicks away. The summary is presented in a window with both textual and graphical representation.
Source files spread over multiple directories are handled. The File List window can display source files either in a flat list or a tree. Lists of source files show filenames with minimum pathnames from the common ancestor directory.
The --suppress-ifdef WORD flag can be used to suppress source lines inside #ifdef or #if blocks which depend on particular pre-processor symbols. For example --suppress-ifdef TEST,DEBUG will suppress source lines inside #if DEBUG or inside #ifdef TEST. Suppressed lines are not reported in summaries. This feature is useful to avoid having test infrastructure or debugging code spuriously reduce the reported coverage level.
The --suppress-comment WORD flag can be used to suppress source lines which contain the given word in a comment. For example --suppress-comment nocover suppresses any line containing the comment /* nocover */. Similarly the --suppress-comment-between STARTWORD,ENDWORD flag suppresses source lines between a line containing STARTWORD in a comment and the next line containing ENDWORD in a comment.
Handles non-local control transfers, e.g. C++ exceptions or C longjmp.
A .desktop file is provided so that ggcov appears in the GNOME menu structure. New source files (or object files, or executables) can be dragged-n-dropped onto ggcov from Nautilus. Configuration parameters are stored in the gconf database.
ggcov comes with a text mode program tggcov which can be used to provide coverage reports for individual source files or entire programs. tggcov is designed for non-interactive use, e.g. as part of a build process or test suite.
The text mode tggcov program has an option to generate an XML report in the format used by the Cobertura tool. This makes it really easy to use in Continuous Integration servers such as Jenkins, with the Cobertura Plugin.
ggcov also comes with a program git-history-coverage which correlates test coverage data to git commits, printing a coverage summary which shows how well tested recent code changes have been. This is useful for nightly builds and Continuous Integration systems such as Jenkins.
Calculates a call graph of all function calls known at compile time (i.e. excluding calls made through function pointers or C++ virtual function tables) and applies coverage data to this call graph. The result is that you can see how many times a function was called from various other functions. The downside of call graph analysis is that ggcov needs to read and pick apart object files to get the call data. The code exists and works for i386 and x86-64 platforms with ELF format executables only.
New in version 0.10 is ggcov-html, which generates static HTML coverage reports. It has many of the features of the GNOME program, including annotated source with flow diagrams, and works in any modern browser.
There's also an older server-side PHP app which has more functionality but requires more setup (see HOWTO.web)
ggcov is known to work on x86-64/Linux and i386/Linux; other platforms should work except for the call graph feature.