Changing code coverage settings

You can edit the configuration settings for code coverage to explicitly include or exclude files, change the information mode, coverage level, and other settings.

Procedure

To change the code coverage settings:
  1. In the project explorer, right-click the project on which you want to change the settings and click Properties.
  2. Click C/C++ Build > Settings and select Build Settings.
  3. Expand Code coverage to access the settings and set the required coverage level for functions, calls, blocks and conditions, as well as any other required settings.
    Instrumentation control
    You can use the coverage type settings to declare various types of coverage. See Coverage levels for more information about these settings.
    Coverage level functions
    Select between function Entries, With exits, or None.
    Coverage level calls
    Select Yes or No to toggle call code coverage.
    Coverage level blocks
    Select the desired block code coverage type. You can combine, enable, or disable any of these coverage types before running the application node. All coverage types selected for instrumentation can be filtered out in the coverage viewer.
    Exclude for loops
    Select Yes to exclude for loops from instrumentation. Only while and do loops are instrumented.
    Coverage level conditions
    Selects the condition level of code coverage to be included in the report:
    • None: The coverage report ignores conditions.
    • Basic: Only basic conditions are included in the coverage report.
    • Modified (MC/DC): Only modified conditions are included in the coverage section of the test report.
    • Modified and Multiple: Both modified and multiple conditions are included in the coverage report.
    • Forced Modified (MC/DC): The report includes modified conditions where all operators are replaced with bitwise operators.
    • Forced Modified and Multiple: The report includes modified and multiple conditions where all operators are replaced with bitwise operators.
    Condition in expressions
    Select Yes to consider relational operators in an expression (for example: y = ( a>0 ) ) as conditions.
    Bitwise as logical
    Select Yes to instrument bitwise operators as logical when both operands are booleans.
    Ternary coverage
    When this option is selected, code coverage reports ternary expressions as statement blocks.
    Information mode
    This setting specifies the information modes to be used by code coverage.
    • Default (Optimized for Code Size and Speed): This setting uses one byte per branch to indicate branch coverage.
    • Compact (Optimized for Memory): This setting uses one bit per branch. This method saves target memory but uses more CPU time.
    • Report Hit Count: This adds information about the number of times each branch was executed. This method uses one integer per branch.
    Excluded function calls
    Specifies a list of functions to be excluded from the call coverage instrumentation type, such as printf or fopen. Use the Add, Remove buttons specify the functions to be excluded.
    Not returning functions
    Type the identifiers (not signatures) of the functions that do not return (functions that execute a longjmp or exit).
    Advanced options
    Trace file name (.tio)
    this allows you to specify a path and filename for the .tio dynamic coverage trace file.
    Key ignore source file path
    Identifies source files based only on the filename instead of the complete path. Use this option to consolidate test results when a same file can be located in different paths. This can be useful in some multi-user environments that use source control. If you use this option, make sure that the source file names used by your application are unique.
    User comment
    This adds a comment to the code coverage report. This can be useful for identifying reports produced under different configurations. To view the comment, click the a magnifying glass symbol that is displayed at the top of your source code in the coverage viewer.
    Report summary
    Select Yes to add the coverage summary to the summary text file of the selected node.
    On-the-fly frequency dump
    Specify the function call number after which the coverage results are updated dynamically during execution. 0 means no update during execution.
  4. Click OK, Apply the changes and close the Properties window.