Command Line Interface
Cover++ has multiple subcommands.
Run a program under coverage.
cover++ run [options] <program> [args...]| Option | Description |
|---|---|
<program> | The executable to run under coverage. |
<args...> | Arguments passed verbatim to the program. |
-s--source <path> | Filter the files for which coverage is collected to this directory. Default: Computed as the root directory of the <program>. For example, running cover++ run D:\foo\bar\baz.exe will use D:\foo as the source root. |
-d--debug-info <path> | Path to the PDB file. Default: Same as the program, with .exe replaced by .pdb |
-o--out <path> | Where to generate the coverage report. Default: ./report.coverpp |
--exclude-source-files-regex <regex> | Source files matching this regex are excluded from coverage. The paths are canonical and use forward slashes. Default: /(vcpkg_installed|_deps)/ |
-v--verbose | Repeatable flag to increase verbosity. |
--print-first-chance-seh | Print first-chance SEH exceptions to the console |
Description
Section titled “Description”All arguments passed after <program> are forwarded verbatim to the program.
View a coverage report in the browser.
Alias: serve
cover++ view [options] [report]| Option | Description |
|---|---|
<report> | Report file to view. Default: ./report.coverpp |
-p--port <port> | Port to serve the report on. Default: 8080 |
--coverpp-install-dir | Installation directory of Cover++. Default: Auto-discovered. |
--no-open | Don’t open the browser; only start the server. |
Remap source locations in a coverage report file.
cover++ remap [options] --to <path> [report]| Option | Description |
|---|---|
<report> | Report file to modify. Default: ./report.coverpp |
--to <path> | New source root. Required. |
--from <path> | Old source root. Default: Inferred from the single source root in the report. |
Note that --from is required if there is more than one source root.
Description
Section titled “Description”You can remap subdirectories of a source root. In that case, the original root will be split in two.
It is not required that either the old or the new source root exist. If the new source root does exist, missing statistics which require source files will be computed. This is useful in case the report was generated on a machine without the source files.
Merge multiple coverage reports into a single file.
cover++ merge -o <output> <inputs...>| Option | Description |
|---|---|
-o--out <path> | Where to place the merged report. |
<inputs...> | One or more report files. |
export json
Section titled “export json”Export a coverage report to a JSON file.
cover++ export json [-o <output>] [report]| Option | Description |
|---|---|
-o--out <path> | Where to place the generated JSON file. Use - to print to the console.Default: - |
<report> | The report file to export. Default: ./report.coverpp |
Examples
Section titled “Examples”Export foo.coverpp to foo.json:
cover++ export json -o foo.json foo.coverppGet the covered lines of a specific file in the first root:
$report = cover++ export json foo.coverpp | ConvertFrom-Json$report.roots[0].children | where file -eq "main.cpp" | select coveredexport gcov
Section titled “export gcov”Export a coverage report to gcov format.
Alias: export clion
cover++ export gcov [-o <output>] [report]| Option | Description |
|---|---|
-o--out <path> | The directory in which to place the generated gcov files.. Default: coverage-gcov-export |
<report> | The report file to export. Default: ./report.coverpp |
Description
Section titled “Description”Gcov’s format is useful primarily because other tools support it. Cover++ supports exporting reports in a format compatible with gcov to enable integration with such tools.
One .gcov file per source file is created in the output directory.
They are named according to a flat numbering scheme (001.gcov, 002.gcov, …).
Each generated file contains the path to the source file and associated coverage information per line.
Starting with CLion 2026.2, it’s possible to import gcov files into the IDE1. To do so, open the Coverage tool window and click Import a report collected in CI from disk. Then, select ALL files in the exported directory.
export teamcity-statistics
Section titled “export teamcity-statistics”Export a coverage report as TeamCity statistics.
cover++ export teamcity-statistics [report]| Option | Description |
|---|---|
<report> | The report file to export. Default: ./report.coverpp |
Description
Section titled “Description”This exporter prints TeamCity service messages that, when running under TeamCity, attach coverage statistics to the build.
There are two primary use cases for this:
-
Quality gates: TeamCity can be configured to fail the build if coverage drops under a certain threshold. This can then be used, for example, to block pull requests.
-
Charts: You can create charts in TeamCity showing how coverage has evolved over time.