In addition to industry-standard C/C++ code coverage metrics, C/C++test can collect code coverage at the assembly level (also known as object code coverage), which provides visibility into which sections of assembly code were covered during test execution, as well as details on branching points execution.
Unlike C/C++ code coverage, assembly coverage results are not integrated with C/C++test views. Reports are available as external HTML, XML, or CSV files. See Generating the Assembly Coverage Report for more details.
This section provides information on collecting object code coverage in your IDE. For details about Parasoft tools for collecting coverage at the assembly level, see the Parasoft ASMtools documentation shipped with C/C++test in <INSTALL_DIR>/bin/engine/asmtool/manuals
.
Assembly code coverage is supported for the following GHS compilers:
C/C++test is preconfigured to collect assembly-level coverage data from Green Hills Software PPC simulator. Contact Parasoft Support for more information if you want to collect object coverage data from on-target tests execution.
Assembly code coverage is supported for the following GNU GCC compilers for x86 (32-bit):
1Support for this compiler is deprecated and will be removed in future releases.
Assuming that your project is configured for unit test execution or application memory monitoring with C/C++test and set up for a supported compiler (see Supported Compilers), no other configuration steps are required.
You can exclude test-harness initializers (added by C/C++test) from the assembly coverage report. Go to Project Properties> Parasoft> C/C++test> Build Settings> Compiler Options and add the following option:
-DCPPTEST_USE_GLOBAL_OBJECTS_TO_INIT_RUNTIME=0 |
This will disable adding the test-harness initializers to compilation units under test. Instead, C/C++test will generate a separate "test runner" for performing test-harness initialization.
C/C++test ships with built-in test configurations for executing unit test cases with assembly coverage monitoring. To view the test configuration settings:
When you run the test configuration, coverage data is stored in the tested program's memory buffers. When the scheduled tests are executed and test executable exits, the collected coverage information is saved via the defined communication channel (typically, directly to the file).
If the test executable crashes or the memory becomes corrupted, the buffers that store coverage data may become corrupted or may not be saved. For this reason, we recommend reviewing test cases prior to execution and excluding from the testing session all tests that may crash the application.
Assembly coverage reports are generated after test execution in the format specified in the test configuration (see Customizing Report Options). There is no assembly coverage data visible in C/C++test’s coverage view, source code editor, or any other component of the C/C++test UI.
The link to the assembly coverage report will be available in the Assembly Coverage column included in the Additional Reports section at the bottom of the main report:
The HTML report links include relative paths that will not be broken when the reports are moved to another location. |
You can customize the format and encoding of the assembly coverage report by modifying the test configuration you will use to execute test cases (see Collecting Assembly Code). Go to General> Test execution flow and configure the following options:
Option Name | Values |
---|---|
Assembly coverage report format | Available formats: html, xml, txt, flattxt, csv The default is html. |
Assembly coverage report encoding | The encoding used for html reports. The default is UTF-8 |
Contact Parasoft Support for more information if you want to collect object coverage data from on-target test execution.