Unit Command.Coverage

Description

This unit contains procedures to configure and execute a command to measure the coverage of the unit tests with kcov.

FPC emits no .gcno/.gcda files, so gcov and lcov do not work with its executables. kcov reads the DWARF line info of the test executable instead and sets a breakpoint on each line, so it needs no instrumentation, only a build with debug info and no optimization: the Coverage build mode that the command adds to the test project.

Overview

Functions and Procedures

procedure CoverageCommand(ABuilder: ICommandBuilder);
procedure Registry(ABuilder: ICommandBuilder);

Description

Functions and Procedures

procedure CoverageCommand(ABuilder: ICommandBuilder);

This command builds the test project in the current folder, or in its tests subfolder, with the Coverage build mode, runs it under kcov and outputs the coverage of each source file of the project, without the tests and the modules. At the root of a workspace it does the same for every member with a tests folder and outputs the total. The units with code that no test uses are not seen by kcov, so they are listed as warnings. The exit code is 1 when the tests could not run, any of them failed or the coverage is below –min.

Parameters
ABuilder
Command builder of the main application that will be used to output the report.
procedure Registry(ABuilder: ICommandBuilder);

Registry a coverage command using the command builder from pascli.

Parameters
ABuilder
Command builder of the main application that will be used to registry the command.

Generated by PasDoc 1.0.4.