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 environment variable COVFILE. 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 on various operating systems.

set COVFILE=c:\source\test.cov (Windows)
export COVFILE=`pwd`/test.cov  (Bourne-compatible shell)
setenv COVFILE `pwd`/test.cov  (C shell)

On Windows you can set environment variables in the Control Panel under System. Be careful not to write spaces at the beginning or end of an environment variable setting.

If your run-time operating system does not support environment variables or does not provide the function getenv, you can set the value of the macro Libcov_covfile to a filename other than test.cov. For details, see Embedded Systems: Build Options.

The Windows installer sets COVFILE to Documents/test.cov, 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. So 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, located 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.

Last reviewed: 3 May 2011