BullseyeCoverage Up Contents Search

The Coverage File

BullseyeCoverage stores coverage data in one file, named test.cov by default. The covc command creates the coverage file if it does not exist and adds an entry for each source file processed. When you run an instrumented executable, the BullseyeCoverage run-time library reads and writes the coverage file. The coverage file does not grow in size when the instrumented executable runs.

The COVFILE Environment Variable

Specify the location of the coverage file with the COVFILE environment variable. The default location of the coverage file is ./test.cov so if you have source files in multiple directories, it is very important that you specify the location of the coverage file; do not use the default. Set COVFILE to the absolute path (fully qualified filename) of the coverage file.

The example commands below set COVFILE at the command prompt.

set COVFILE=c:\source\test.cov      ← Windows
export COVFILE=/source/test.cov     ← Unix-like shell

On Windows, you can set environment variables by running SystemPropertiesAdvanced.exe.

The Windows installer sets COVFILE to Documents/test.cov by default. However, you should adjust the value to suit your project as described below.

Choose the Coverage File Location Before Building

The coverage file contains file names that are relative to the directory where the coverage file is located. The ideal location for the coverage file is the parent of all the directories containing source files. For example, consider a project consisting of the following source files.

/project/src/dir1/source1.c
/project/src/dir1/source2.c
/project/src/dir2/dir3/source3.c
/project/src/source4.c

For this example, the ideal location for the coverage file is /project/src/test.cov.

If you do not have permission to create the data file in the ideal location, locate it as close as possible to the ideal location.

Do not move the coverage file. Rather, delete the coverage file, change COVFILE and then rebuild your project to recreate it in the new location.

Updated: 5 Sep 2024