C++ Python CSS Makefile Shell Vim script Other
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
data
docs
doxygen
scripts
src
tests
web
.gitignore
COPYING
INSTALL.md
Makefile
README.md
TODO.md
config.h.in
uncov-gcov

README.md

uncov, v0.2, 2016 – 2017

This file last updated on 06 December, 2017

  1. Description
  2. Supported Environment
  3. Usage/example/screenshots
  4. Credits
  5. License

Description

uncov is a tool that collects and processes coverage reports.

By storing history of coverage reports it allows one to view how code coverage changes over time, compare changes that happened and view current state of the coverage.

The tool is deeply integrated with git repository of processed projects and thus avoids generation of static reports. Data is bound to repository information, but can be freely shared by several copies of the same repository (builds referring to unavailable git objects just won't be accessible).

Provided command-line interface should be familiar to most of git users and helps to avoid switching to a browser to verify code coverage.

It's also possible to display coverage information in a browser, say, on a CI server. This makes uncov something like self-hosted coveralls.io analogue (but note that Web-interface is secondary in this case and isn't feature complete).

Features

  • Code highlighting.
  • Comparison of coverage.
  • Displaying parts of files that need attention with regard to coverage.
  • Can be used from Vim via the plugin provided.
  • Can be used on CI to display coverage in a browser (via Web-UI).

Structure

Storage management tool itself is language independent and is relying on complementary tools to fetch and transform coverage data from language specific coverage harness.

Importer of coverage for C and C++ languages that collects data from gcov is provided.

Adding support for a language

Support for other languages can be added by converting existing coverage tools or even using them as is. The new-json subcommand accepts JSON that's used by coveralls.io API, all what's needed is to extract this JSON and pipe it to uncov new-json (some tools might already have a command-line option like --dump, others could be extended by adding it).

Status

Overall structure and basic elements are expected to remain in place, however they aren't finalized and changes for the sake of improvement are possible. Databases will be migrated if schema changes, so previously collected data won't be lost.

Main things missing

  • Configuration. Currently values that could be configurable are hard-coded.
  • Tuning behaviour with command-line parameters.

Supported Environment

Expected to work in Unix-like environments.

Prerequisites

  • GNU Make.
  • C++11 compatible compiler (GCC 4.9 works fine).
  • Boost, tested with 1.55 and 1.59, but older versions might work.
  • libgit2.
  • libsqlite3.
  • libsource-highlight from GNU Source-highlight.
  • zlib.
  • (optional) tntnet for Web-UI.
  • (optional) pandoc for regenerating man page.
  • (optional) python for collecting coverage for C and C++ (would be nice to get rid of this weird dependency, probably by rewriting the tool).

Usage

uncov-gcov can be used to generate coverage, but it seems to not play well with out-of-tree builds (some coverage is missing, this issue is inherited from its origin), so the recommended way of recording coverage information is shown in example below:

# reset coverage counters from previous runs
find . -name '*.gcda' -delete
# < run tests here >
# generage coverage for every object file found (change "." to build root)
find . -name '*.o' -exec gcov -p {} +
# generage and combine coverage reports (--capture-worktree automatically
# makes stray commit if repository is dirty)
uncov-gcov --root . --no-gcov --capture-worktree --exclude tests | uncov new
# remove coverage reports
find . -name '*.gcov' -delete

Example

The easiest way of checking out uncov is by using it on itself (assuming that you have just built it or just happen to have all the necessary development dependencies).

In root of the project run make self-coverage and then do coverage/uncov build to see something similar to:

build

coverage/uncov dirs shows coverage per directory:

dirs

coverage/uncov changed shows files which have their coverage changed:

changed

coverage/uncov show src/SubCommand.cpp shows annotated src/SubCommand.cpp file:

show

When most of a file is covered, one probably wants to see just what's not yet covered, this can be done with coverage/uncov missed command:

missed

More Screenshots

Not everything can be demonstrated by self-coverage example above, so here are some other interesting things. List of latest builds (uncov builds):

builds

Results of comparison (uncov diff):

diff

Annotated source code in Web-UI:

Web-UI

Web-UI Demo

Deployed Web-interface can be seen here.

Credits

  • LCOV project is the source of useful ideas and primary source of inspiration.
  • coveralls.io service is second project which significantly shaped this tool.
  • Code of uncov-gcov is based on cpp-coveralls.
  • gcov-marker.vim was the source of idea of filling location list with not covered lines in the plugin.

License

AGPLv3+

GNU Affero General Public License, version 3 or later.