Skip to content

Code coverage tool for compiled programs, Python and Bash which uses debugging information to collect and report data without special compilation options

License

GPL-2.0, Unknown licenses found

Licenses found

GPL-2.0
COPYING
Unknown
COPYING.externals
Notifications You must be signed in to change notification settings

chradcliffe/kcov

 
 

Repository files navigation

Build Status Coveralls coverage status Codecov coverage status Coverity Scan Build Status

PayPal Donate Github All Releases

kcov

Kcov is a 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 one of the pre-built Docker images:

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.

Travis-ci / coveralls integration

kcov coverage collection is easy to integrate with travis-ci and coveralls.io. To upload data from the travis build to coveralls, run kcov with

kcov --coveralls-id=$TRAVIS_JOB_ID /path/to/outdir executable

which in addition to regular coverage collection uploads to coveralls.

Travis-ci / codecov integration

Integrating with codecov is also simple. To upload data from the travis build to codecov, run kcov normally, and then upload using the codecov uploader

kcov /path/to/outdir executable
bash <(curl -s https://codecov.io/bash) -s /path/to/outdir

The easiest way to achieve this is to run the codecov uploader on travis success:

after_success:
  - bash <(curl -s https://codecov.io/bash) -s /path/to/outdir

the -s /path/to/outdir part can be skipped if kcov produces output in the current directory.

Full-system instrumentation

Using dyninst, 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

About

Code coverage tool for compiled programs, Python and Bash which uses debugging information to collect and report data without special compilation options

Resources

License

GPL-2.0, Unknown licenses found

Licenses found

GPL-2.0
COPYING
Unknown
COPYING.externals

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 56.8%
  • JavaScript 17.0%
  • Python 10.4%
  • CMake 5.6%
  • C 5.4%
  • CSS 1.6%
  • Other 3.2%