Page tree

Skip to end of metadata
Go to start of metadata

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 CVS 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]\engine\asmtool\manuals.

Supported Compilers

On Windows

Assembly code coverage is supported for the following GHS compilers:

  • Green Hills Software Compiler for PPC v. 3.5.x
  • Green Hills Software Compiler for PPC v. 4.0.x
  • Green Hills Software Compiler for PPC v. 4.2.x
  • Green Hills Software Compiler for PPC v. 2017.1.x

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.

On Linux 64-bit:

Assembly code coverage is supported for the following GNU GCC compilers for x86 (32-bit):

  • GNU GCC 4.6.x
  • GNU GCC 4.7.x
  • GNU GCC 4.8.x
  • GNU GCC 4.9.x
  • GNU GCC 5.x
  • GNU GCC 6.x
  • GNU GCC 7.x
  • GNU GCC 8.x

Configuring Project Settings

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++test> Build Settings> Compiler Options and add the following option:


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.

Collecting Assembly Code

C/C++test ships with built-in test configurations for executing unit test cases with assembly coverage monitoring.  To view the test configuration settings:

  1. Choose Parasoft> Test Configurations form your IDE menu.
  2. Select of the following built-in test configuration:
    On Windows: Builtin> Embedded Systems> Green Hills Software> Run GHS Tests with Assembly Coverage Monitoring
    On Linux: Builtin>Embedded Systems>GNU GCC>Run GNU GCC Tests with Assembly Coverage Monitoring

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).

(info)  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 the tests cases prior to execution and excluding from the testing session all tests that may crash the application.

Generating the Assembly Coverage Report

Assembly coverage reports are generated after tests 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.

  1. After executing the test configuration, click Generate Report button.

  2. Click Preferences and choose HTML (C++test’s Unit Testing details) from the Report Format drop-down menu.
  3. Apply your settings and click OK to exit the Preferences dialog
  4. Click OK on the Report & Publish dialog.

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 main report:

The HTML report links include relative paths that will not be broken when the reports are moved to another location.

Customizing Report Options

You can customize the format and encoding of the assembly coverage report by modifying the test configuration you will use to execute tests cases (see Collecting Assembly Code). Go to General> Test execution flow and configure the following options:

Option NameValues
Assembly coverage report format

Available formats: html, xml, txt, flattxt, csv

The default is html.

Assembly coverage report encoding

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 tests execution.

Additional Notes About Assembly Coverage

  • Assembly coverage metrics are only supported for the selected compilers (see Assembly Code Coverage). The C/C++test console will print a message to the console if you run assembly coverage monitoring with a project configured for an unsupported compiler.
  • Assembly coverage is collected through assembler source code instrumentation generated from C/C++ instrumented code. You should not therefore enable other instrumentation features that will make C/C++ instrumented code significantly different from original code. The recommended configuration of instrumentation features is shown on the screen shot below.

  • No labels