Contenuto principale

pstest_add_report_target

(CMake) Generate XML and HTML reports from test or code profiling results

Since R2025a

Description

This function in the Polyspace® Test™ CMake package creates a target for generating XML or HTML reports from C/C++ test or code profiling results. When you invoke this target, it uses polyspace-test -report to perform the report generation.

pstest_add_report_target(target RESULTS_DIRS dir1 dir2 ... dirN REPORTS_DIR reportsDir report_format) creates a target for generating XML or HTML reports from test and code profiling results in folders dir1 dir2 ... dirN.

example

pstest_add_report_target(target RESULTS_DIRS dir1 dir2 ... dirN REPORTS_DIR reportsDir report_format [OTHER_ARGS arg1 arg2 ... argN]) allows you to specify additional options for customizing the report generation process.

Examples

collapse all

This example shows how to create a target for generating XML and HTML reports of test and code profiling results from standard Polyspace Test formats. For an example that demonstrates the complete workflow, see Calculate Code Coverage of xUnit API-Based Tests Using CMake.

The files used for this example are available in the folder polyspaceroot/polyspace/examples/pstest/Getting_Started_Example. Here, polyspaceroot is the Polyspace Test installation folder, for example /usr/local/Polyspace/R2025a. Copy this folder to a writable location in your file system, such as /usr/data/Getting_Started_Example.

Suppose that your test and code profiling results files in standard Polyspace Test formats (.pstestr and .psprof) are located in the results folder. In your CMakeLists.txt file, create the target report using this CMake command:

pstest_add_report_target(report RESULTS_DIRS results REPORTS_DIR reports HTML XML)

Build and run your tests, and then invoke the report target. A reports folder is created that contains XML and HTML reports for your test and code profiling results.

Input Arguments

collapse all

Name of the target that you must invoke to create XML and HTML reports for test and code profiling result in standard Polyspace Test formats.

One or more space-separated paths to folders containing:

  • Test result files in .pstestr format.

  • Code profiling result files in .psprof format.

Path to folder where the converted XML and HTML reports are stored, specified as a string.

Whether to generate XML or HTML reports for test and code profiling results. To create a target that generates both XML and HTML reports, specify both values as space-separated strings.

Additional report generation options that CMake forwards to polyspace-test -report.

Version History

Introduced in R2025a