Note
Coverage support is deprecated and will be removed in a future version of the oneAPI Construction Kit.
Module providing support for lcov, a graphical front-end for GCC’s coverage testing tool gcov.
To access the commands and variables in this module:
include(Coverage)
- COVERAGE_XML_INPUT
The XML input file path to pass to the coverage script.
- COVERAGE_COMPILATION_FLAGS
Compilation flags for coverage checking.
- COVERAGE_LINKING_FLAGS
Linking flags for coverage checking.
- COVERAGE_SOURCES
List of source file directories to include in coverage, populated by function
add_coverage_modules()
.
- COVERAGE_OBJECTS
List containing an object file directory associated to each source directory in
COVERAGE_SOURCES
, populated by functionadd_coverage_modules()
.
- COVERAGE_TEST_SUITES
List of test suite CMake targets to generate coverage information for, populated by
add_coverage_test_suite()
.
- COVERAGE_SCRIPT_PATH
Path to the entry point of the code coverage checker Python script.
- COVERAGE_FLAGS
Flags to pass to the code coverage script, following format ‘
[FLAG-NAME] [SPACE] [FLAG-VALUE]
’.
- add_coverage_modules
This function adds ‘
source directory, object directory
’ pairs to the list of modules to target. It is invoked by theCMakeLists.txt
files of individual ComputeAorta modules which have this information available.- Arguments:
ARGV
- Even index arguments contain source directories, and are appended toCOVERAGE_SOURCES
. Odd indexed arguments contain directory names for the object files, and are appended toCOVERAGE_OBJECTS
.
- add_coverage_test_suite
Function adding a test suite and flags to the list of test suites to be run by the script.
- Arguments:
test_suite
- Target name of test suite, appended toCOVERAGE_TEST_SUITES
.
- Keyword Arguments:
COMMAND
- Command to execute test suite.ENVIRONMENT
- Environment variables of the form “VAR=<value>”.
- add_coverage_xml_input
Creates a CMake target
coverage_input
for generating the XML input file to gathering coverage information on test suite targets inCOVERAGE_TEST_SUITES
.
- add_coverage_custom_target
When the
CA_ENABLE_COVERAGE
variable is set, this function uses CMake add_custom_target to add the following commands:move_files
Copies the generated files
coreConfig.h
andcoreSelect.h
from the build directory to source directory so they can be included in coverage metrics.remove_files
Deletes files
coreConfig.h
andcoreSelect.h
from the source directory.coverage
Copies
coreConfig.h
andcoreSelect.h
from the build directory to source directory. Runs the coverage scriptCOVERAGE_SCRIPT_PATH
, then deletes the copiedcoreConfig.h
andcoreSelect.h
files from the source directory.
To start code coverage analysis a user should run the
coverage
target:$ ninja coverage
Note
The root oneAPI Construction Kit CMakeLists.txt
uses
ca_option()
to create the variable
CA_ENABLE_COVERAGE
. When set the functions
add_coverage_xml_input()
and
add_coverage_custom_xml()
will be invoked by our CMake.
CoverageXMLInput Module
CoverageXMLInput.cmake
is used as part of the implementation of
add_coverage_xml_input from the Coverage Module.
A CMake script for generating an XML file to be used to calculate coverage
information. Script should be invoked using -P
as part of an internal
CMAKE_COMMAND. The following CMake input variables are
required to be set by Coverage Module:
- COVERAGE_XML_INPUT
Output variable containing generated XML.