The cpptestcc
code instrumentation utility is designed as a prefix for the compilation command lines invoked by your build system.
When integrating cpptestcc
with your build, depending on your requirements, you can either add a dedicated build configuration for the coverage mode alongside the typical Release and Debug configurations, or modify an existing configuration to include coverage instrumentation.
See below for examples of regular and coverage mode compilation command lines.
Regular compilation command line, invoked by the build system for typical Release/Debug build configurations:
cc -I app/includes -D defines -c source.cpp |
Coverage-enabled mode compilation command line:
cpptestcc -compiler gcc_9-64 -line-coverage -workspace /home/test/proj/cov -- cc -I app/includes -D defines -c source.cpp |
When the coverage-enabled mode compilation command line is executed, cpptestcc
performs the following operations:
-workspace
switch; additional information about the code structure used during report generation is also stored. Coverage mode compilation command lines must follow the pattern below:
cpptestcc -compiler <compiler configuration> <coverage metric specification> <additional options> -workspace <workspace directory> -- <compilation command line> |
You can add the <INSTALL_DIR>/bin
directory to your PATH variable so that you do not have to use full paths when specifying the cpptestcc
command. All examples in this documentation assume this has been done.
<compiler configuration>
refers to a supported compiler configuration, e.g., gcc_9-64; see Compilers for the list of supported compilers. <coverage metric specification>
refers to a supported coverage metric, e.g., line-coverage. See Command Line Reference for cpptestcc for the list of supported coverage metrics. <additional options>
refers to any additional options that may be required to fine-tune the instrumentation process. See Fine-Tuning Code Instrumentation and Command Line Reference for cpptestcc for the complete list of options supported by cpptestcc
. cpptestcc
command line is separated from the compiler command line with the --
separator.Changes in your build scrips required for integrating cpptestcc
coverage instrumentation depend on your build system and project-specific build script configuration. Inspect your build scripts and build system documentation for instructions on modifying compilation rules.