...
We recommend that you keep consistency with the metrics enabled for the cpptestcc
tool in the compilation command line.
Anchor | ||||
---|---|---|---|---|
|
C/C++test ships with an extension for CMake that allows you to integrate C/C++test's code coverage analysis directly into your CMake project. The extension automatically modifies your compiler/linker command lines to use the cpptestcc
coverage tool when building your project. As a result, after you run the instrumented application or execute functional or unit tests, a C/C++test coverage log file (.clog) is created. The coverage log file can then be used to generate a complete code coverage report.
...
Copy the cpptest.c file from
<INSTALL_DIR>
/bin/engine/coverage/runtime/src/cpptest.c
to your preferred location.- Introduce any customizations as described in Customizing the Runtime Library.
- Set up a build system of your preference (e.g., IAR Embedded Workbench project or any other type of source code builder).
Modify the compilation flags to contain the compiler include a flag (typically
-I
) with the following value:-I <INSTALL_DIR>/bin/engine/coverage/runtime/include-I <INSTALL_DIR>/engine/coverage/runtime/include
- Add any required configuration defines (typically
-D)
, for example:-DCPPTEST_FILE_COMMUNICATION -DCPPTEST_NO_THREADS
- Invoke the command to run your builder (for example, select build command in the IDE).
- Locate the resulting object file and use it to link with your instrumented application.
...