Contenuto principale

polyspace-test -dccc

R2026b

(System Command) Generate Data Coupling and Control Coupling (DCCC) coverage data from static and dynamic results (requires Polyspace Code Prover)

Since R2026b

Description

The system command polyspace-test -dccc combines Polyspace® Code Prover™ static analysis results with Polyspace Test™ per-test coverage data to produce a data coupling and control coupling coverage report.

polyspace-test -dccc -code-prover-results-file <codeProverResults> -pstest-results-file <testResults> [-component-definition <componentFile>] [options] generates data coupling and control coupling (DCCC) coverage data by combining Polyspace Code Prover static analysis results with Polyspace Test per-test coverage data. The analysis identifies cross-component interactions in your code, determines whether your tests cover them, and produces a .dccc file.

You can optionally provide a component definition file <componentFile> that specifies which source files belong to which software component. If you do not provide this file, the polyspace-test command automatically assigns a separate component to each source file.

The command also accepts additional options that control the output format and location.

To learn about how Polyspace defines components, data coupling, and control coupling, see Calculate Coverage of Data Couplings and Control Couplings (DCCC) in C/C++ Code.

example

polyspace-test -dccc -options-file <optionsFile> generates DCCC coverage data and produces a .dccc file using the options specified in <optionsFile>.

Examples

collapse all

This example shows how to generate a data coupling and control coupling coverage report from Polyspace Code Prover results and Polyspace Test results. The example uses a component definition file to group source files into logical software components.

Follow these steps using files in the folder <polyspaceroot>\polyspace\examples\doc_cxx\data_coupling_control_coupling. Here, <polyspaceroot> is the Polyspace installation folder.

  1. Create a Polyspace Platform project from the compilation database:

    polyspace-configure -output-platform-project myProject.psprjx -compilation-database ccdb.json

  2. Run Polyspace Code Prover on the project to generate static analysis results:

    polyspace-project -generate-launching-script-for myProject.psprjx -product code-prover -output-dir cpResults
    polyspace-code-prover -main-generator -results-dir cpResults

    The command generates a .pscp results file in the folder cpResults.

  3. Run the tests with code coverage enabled to generate Polyspace Test results:

    polyspace-test -run -project myProject.psprjx -profiling-mode coverage -results-dir testResults

    The command generates a .pstestr results file in the folder testResults.

  4. Run the polyspace-test -dccc command with the Code Prover results, the test results, and a component definition file:

    polyspace-test -dccc -code-prover-results-file cpResults\ps_results.pscp -pstest-results-file testResults\ps_test.pstestr -component-definition component_spec.toml -results-dir dcccResults

    The component definition file component_spec.toml groups source files into components:

    [[Component]]
    Name = "Engine"
    Spec = [ "**/engine.c", "**/engine.h" ]
    
    [[Component]]
    Name = "Controller"
    Spec = [ "**/controller.c" ]

    The command produces a DCCC results file (ps_dccc.psdccc) in the dcccResults folder.

  5. If you are using the Polyspace Platform UI, you can open the ps_dccc.psdccc file and view the Data and Control Coupling Coverage dashboard.

    DCCC dashboard in the Polyspace Platform UI.

    Click any button on this dashboard to open the Data Coupling and Control Coupling dashboards. Then click any button on these individual dashboards to open an HTML report for the DCCC coverage results.

  6. If you continue to use the command line, generate an HTML report from the DCCC coverage results:

    polyspace-test -report -html -report-dir htmlReport dcccResults\ps_dccc.psdccc

    The HTML report shows control coupling and data coupling coverage for interactions between the Engine and Controller components.

    Optionally, generate an XML report for integration with custom tooling:

    polyspace-test -report -xml -report-dir xmlReport dcccResults\ps_dccc.psdccc

Input Arguments

collapse all

Absolute or relative path of Polyspace Code Prover results file (.pscp). This option is mandatory.

Example: -code-prover-results-file results.pscp

Example: -code-prover-results-file "C:\Results\analysis.pscp"

Absolute or relative path of Polyspace Test results file (.pstestr). This option is mandatory.

Example: -pstest-results-file results.pstestr

Example: -pstest-results-file "C:\Results\test_results.pstestr"

Absolute or relative path of the component definition file in TOML format. The component definition file specifies which source files belong to which software component using glob patterns.

If you omit this option, each source file is treated as its own component.

Example: -component-definition components.toml

OptionDescription
-results-dir <resultsFolder>Absolute or relative path of the directory where results files are saved. If you omit this option, the results files are saved in the current directory.
-results-name <resultsName>Optional name of the results file. If you omit this option, the default name ps_dccc.psdccc is used.
-csvGenerate a CSV report from the DCCC coverage results.
-html

Generate an HTML report from the DCCC coverage results. The HTML report shows:

  • A control coupling summary with coverage counts for each component pair.

  • Detailed tables listing each function call, its source location, whether it is direct or indirect, and which tests cover it.

  • A data coupling summary showing shared global variables between component pairs and their coverage status.

  • Requirement traceability information for tests that have linked requirements.

Path to text file containing options to use with the polyspace-test -dccc command. The file must contain one option per line.

Version History

Introduced in R2026b