主要内容

Import Review Information from Previous Coverage Results

R2026b

Using Polyspace® Test™, you can calculate how much of your C/C++ code is covered by existing tests. If your workflow requires justifying missing coverage that you do not plan to fix, you can add your comments and justifications in the coverage results and reuse them in future runs.

This topic explains how to import justifications from one set of coverage results into another.

Prerequisites

You can follow this tutorial with any coverage results set. To get a starting set of coverage results:

  1. On the Start Page pane, in the Examples section, select Create and run functional tests.

  2. After the example project loads, in the Profiling section of the toolstrip, select Code Coverage instead of No Profiling. Then, select Run Tests.

  3. After the test runs complete, in the Results pane, right-click the Coverage node and select Open Review to load the coverage result details in the Review perspective.

Export Review Information

In the Review perspective, add justifications to results showing missing coverage and export the justifications for further reuse:

  1. In the Results List pane, select a result. In the Result Details pane, set its Status to Justified. Enter a comment that explains your justification.

  2. On the toolstrip, select Save.

    This action saves the justifications to a filter file named ps_coverage.psprof.filter alongside the coverage results. To locate this file in your explorer, in the Results pane, right-click the Coverage node and select Show in Explorer.

Import Into New Results

Import the previously saved justifications into new coverage results for the same or updated source code:

  1. Open your new coverage results in the Review perspective.

  2. On the toolstrip, select Import. Navigate to the location of the previously saved filter file (.psprof.filter file) and select Open.

The previously saved justifications now appear in the new results. If your previous comments and justifications do not appear as expected, see Troubleshoot Missing Review Data After Importing from Previous Coverage Results.

You can also import the justifications at the command-line after computing coverage results using the polyspace-code-profiler command. To import justifications, use the option -import-filters with the path to previous and current coverage results folders. See polyspace-code-profiler.

See Also

Topics