The examples in this section describe several classes of projects and ways to approach integrating C/C++test.
Build includes compilation of multiple source files without static or dynamic libraries.
Compilation phase:
For all sources files or selected subsets, compilation should be prefixed withcpptestcc
tool with options for enabling the desired coverage metrics.
Linking phase:
The linker command line should be modified to include the coverage tool library. In most of the cases, you will include the static library:g++ source1.o source2.o <cov tool install dir>/runtime/lib/cpptest.a
- Build includes compilation of multiple source files and the preparation of multiple static libraries, which are linked to the main objects.
Compilation phase:
For all sources files or selected subsets, compilation should be prefixed withcpptestcc
tool with options for enabling desired coverage metrics. If coverage from static libraries should also be collected, they need to be instrumented, as well.
Linking phase:
The linker command line should be modified to include the coverage tool library. In most of the cases, you will include the static library. It is important to add the coverage tool library only once, usually during executable linking. Static libraries created during the build should not contain the coverage library. - Build includes compilation of multiple source files and preparation of multiple dynamic/shared libraries which are linked with main objects.
Compilation phase:
For all sources files or selected subsets, compilation should be prefixed withcpptestcc
tool with options for enabling desired coverage metrics. If coverage from dynamic libraries should also be collected, they need to be instrumented, as well.
Linking phase:
- Linking command lines for dynamic libraries should be modified to include the coverage tool shared/dynamic-load library.
- Linking command lines for static libraries should not be modified.
- Linking command line for executable should be modified to include coverage tool shared/dynamic library - Build includes the following:
- Compilation of multiple source files
- Preparation of multiple dynamic/shared libraries linked with main objects
- Multiple static libraries linked with main objects
Compilation phase:
For all sources files or selected subsets, compilation should be prefixed withcpptestcc
tool with options for enabling desired coverage metrics. If coverage from dynamic or shared libraries should also be collected, they need to be instrumented, as well.
Linking phase:
- Linking command lines for dynamic libraries should be modified to include the coverage tool shared/dynamic-load library.
- Linking command lines for static libraries should not be modified.
- Linking command line for executable should be modified to include coverage tool shared/dynamic library