Skip to content

About

This repository provides a quick start guide for covdbg

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

23 Commits

Folders and files

Repository files navigation

covdbg Quick Start

Build a small C++ application and collect code coverage with the latest covdbg release on Windows.

Prerequisites

  • Windows 10 (x64) or Windows 11
  • Visual Studio with the Desktop development with C++ workload
  • CMake 3.20 or newer
  • A GitHub account for signing in

Installation

Download the latest covdbg MSI installer and run it. It installs covdbg for your Windows user and adds it to PATH. Open a new terminal and verify the version:

covdbg --version

Alternatively, extract the latest portable ZIP and add its directory to PATH. Keep covdbg.exe and its agent DLLs together in one folder.

Sign in before collecting coverage:

covdbg login

Follow the browser sign-in instructions printed by the command.

The browser sign-in ends with choosing the team to sign in for. Use covdbg login --team personal to skip the choice, and covdbg whoami to check (Signed in as <email> for <team>). Personal use covers one private repository at a time.

Build

Clone this example and build it with debug symbols (PDB files):

git clone https://github.com/liasoft/covdbg-quick-start.git
cd covdbg-quick-start
cmake -S . -B build
cmake --build build --config Debug

The build produces test_app.exe and test_app.pdb in build/Debug.

Running covdbg

Collect coverage while running the application:

covdbg --config .covdbg.yaml --output .\build\Debug\test_app.covdb .\build\Debug\test_app.exe
covdbg: collecting coverage for C:\src\covdbg-quick-start\build\Debug\test_app.exe
Hello, World!
covdbg: test_app.exe exited with code 0
covdbg: coverage written to .\build\Debug\test_app.covdb
covdbg: 4 of 6 basic blocks hit (66.7%), analysis 49 ms, run 89 ms

The run took the Hello, World! path, so the greeting with a name in src/main.cpp shows as not run. Run the program again with a name, into a second database, and merge the two to cover both paths:

covdbg --config .covdbg.yaml --output .\build\Debug\test_app-name.covdb .\build\Debug\test_app.exe Ada
covdbg merge -i .\build\Debug\test_app.covdb -i .\build\Debug\test_app-name.covdb -o .\build\Debug\merged.covdb

Convert the coverage database to LCOV for use with other tools:

covdbg convert --format LCOV --input .\build\Debug\test_app.covdb --output .\build\Debug\test_app.lcov

GitHub Actions

The included workflow builds the example on Windows x64 (windows-latest) and Windows ARM64 (windows-11-arm), installs covdbg 1.5.1 with liasoft/setup-covdbg@v1, and uploads the LCOV and Cobertura reports for each. The tests run with --propagate-exit-code, so a failing test run fails the job, and the convert and upload steps run with if: always() to still report its coverage.

Public repositories are free and need no secret. With permissions: id-token: write on the job, covdbg presents the token GitHub issues to the run, which names the repository, and a public repository is licensed. The workflow runs on pushes and on pull requests opened from this repository: GitHub issues no token to a pull request from a fork, so the workflow skips those instead of failing.

A private repository still needs a project token. Add a repository Actions secret named COVDBG_PROJECT_TOKEN containing a project token from app.covdbg.com, and pass it to the Run Coverage step through env. CI does not use the interactive covdbg login command.

Note

covdbg 1.5.0 and newer license a public repository's GitHub Actions run without a token. The old --fetch-license, COVDBG_LICENSE, and COVDBG_LICENSE_FILE options are no longer supported.

About

This repository provides a quick start guide for covdbg

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages