Code coverage tool for compiled programs, Python and Bash which uses debugging information to collec...
The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:
Kcov is a FreeBSD/Linux/OSX code coverage tester for compiled languages, Python and Bash. Kcov was originally a fork of Bcov, but has since evolved to support a large feature set in addition to that of Bcov.
Kcov, like Bcov, uses DWARF debugging information for compiled programs to make it possible to collect coverage information without special compiler switches.
For a video introduction, look at this presentation from SwedenCPP
Refer to the INSTALL file for build instructions, or use our official Docker images:
Tags v31-v33 are re-tags of ragnaroek/kcov which were not automated builds.
Tags v34-v35 are non automated builds using the Dockerfile in master with 1 minor modification.
Tag v36 is a non automated build using the Dockerfile in master.
Basic usage is straight-forward:
kcov /path/to/outdir executable [args for the executable]
/path/to/outdir will contain lcov-style HTML output generated continuously while the application runs. Kcov will also write cobertura- compatible XML output and can upload coverage data directly to http://coveralls.io for easy integration with travis-ci. A generic coverage.json report is also generated which contains summaries for a given binary and each source file.
It's often useful to filter output, since e.g., /usr/include is seldom of interest. This can be done in two ways:
kcov --exclude-pattern=/usr/include --include-pattern=part/of/path,other/path \ /path/to/outdir executable
which will do a string-comparison and include everything which contains part/of/path or other/path but exclude everything that has the /usr/include string in it.
kcov --include-path=/my/src/path /path/to/outdir executable kcov --exclude-path=/usr/include /path/to/outdir executable
Does the same thing, but with proper path lookups.
Kcov can also merge the results of multiple earlier runs. To use this mode, call kcov with
--merge, an output path and one or more paths to an earlier run, e.g.,
kcov --merge /tmp/merged-output /tmp/kcov-output1 /tmp/kcov-output2 kcov --merge /tmp/merged-output /tmp/kcov-output* # With a wildcard
Kcov can instrument all binaries with very low overhead for embedded systems. Refer to the full system instrumentation documentation for details.