Code coverage tool for compiled programs, Python and Bash which uses debugging information to collect and report data without special compilation options
Clone or download
SimonKagstrom Merge pull request #275 from mmlb/patch-1
readme: expand info on origins of tagged docker images
Latest commit ab4774d Oct 25, 2018
Permalink
Failed to load latest commit information.
cmake Use FindPkgConfig to give hints to FindElfutils and FindLibElf Apr 30, 2018
data Code coverage report behind nginx/1.15.0 can not show well which resp… Jun 11, 2018
debian debian package files Sep 21, 2018
doc Simpify installation destinations and install license files May 2, 2018
external/lldb/include/lldb Issue #135: external: Add imported headers from LLDB Nov 7, 2016
src Issue #190: Reformat code according to K&R Aug 24, 2018
tests Issue #190: Reformat code according to K&R Aug 24, 2018
tools Add messages with location of found executable and library paths May 2, 2018
travis travis: Allow unauthenticated packages Jun 26, 2018
.dockerignore add Dockerfile Oct 19, 2018
.gitignore debian package files Sep 21, 2018
.gitmodules unit test: Add git submodule ref to trompeloeil Jan 6, 2015
.travis.yml Issue #161: travis: Run coverity on OSX as well Nov 10, 2016
CMakeLists.txt Use option() instead of boolean cache variable May 2, 2018
COPYING Issue #217: COPYING: Update with modern GPLv2 Sep 30, 2017
COPYING.externals Correct external licenses May 17, 2018
CPack.local.cmake Add CPack variables for Debian packaging Apr 30, 2018
ChangeLog Issue #190: Reformat code according to K&R Aug 24, 2018
Dockerfile add Dockerfile Oct 19, 2018
INSTALL.md Initial build support for FreeBSD. May 15, 2018
README README: Link README -> README.md (for cmake) Nov 16, 2016
README.md readme: expand info on origins of tagged docker images Oct 24, 2018

README.md

Build Status Coveralls coverage status Codecov coverage status Coverity Scan Build Status Docker Build Status MicroBadger Size Docker Pulls

PayPal Donate Github All Releases

kcov

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.

Installing

Refer to the INSTALL file for build instructions, or use our official Docker images:

Note:

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.

How to use it

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.

Filtering output

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.

Use from continuous integration systems

kcov is easy to integrate with travis-ci together with coveralls.io or codecov.io. It can also be used from Jenkins, SonarQube and GitLab CI. Refer to

  • coveralls for details about travis-ci + coveralls, or
  • codecov for details about travis-ci + codecov
  • jenkins for details about how to integrate in Jenkins
  • sonarqube for how to use kcov and sonarqube together
  • gitlab for use with GitLab

Full-system instrumentation

Kcov can instrument all binaries with very low overhead for embedded systems. Refer to the full system instrumentation documentation for details.

More information

kcov is written by Simon Kagstrom simon.kagstrom@gmail.com and more information can be found at the web page