Contenuto principale

pstest_add_convert_target

(CMake) Create target for converting test or code profiling results to standard Polyspace Test format

Since R2025a

Description

This function in the Polyspace® Test™ CMake package creates a target for converting test and code profiling results from a machine-readable, XML, or binary format to a format that can be reviewed in the Polyspace Platform user interface. When you invoke this target, it uses polyspace-test -convert to perform the conversion.

pstest_add_convert_target(target RESULTS_DIRS dir1 dir2 ... dirN CONVERTED_RESULTS_DIR resultsDir) creates a target target for converting:

  • Test results from a machine-readable (.mrf) or XML format to the standard Polyspace Test result (.pstestr) format.

  • Code profiling results from a binary (.bin) format to the standard Polyspace Test code profiling result (.psprof) format.

You can then review these results in the Polyspace Platform user interface or upload the results to the Polyspace Access™ web server.

example

pstest_add_convert_target(target RESULTS_DIRS dir1 dir2 ... dirN CONVERTED_RESULTS_DIR resultsDir [CONVERTED_RESULTS_NAME resultsName]) allows you to specify the name name for the generated results files.

pstest_add_convert_target(target RESULTS_DIRS dir1 dir2 ... dirN CONVERTED_RESULTS_DIR resultsDir [CONVERTED_RESULTS_NAME resultsName] [OTHER_ARGS arg1 arg2 ... argN]) allows you to specify additional options for customizing the conversion process.

Examples

collapse all

This example shows how to create a target for converting test and code profiling results to 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 are located in the out folder. In your CMakeLists.txt file, create the target convert using this CMake command:

pstest_add_convert_target(convert RESULTS_DIRS out CONVERTED_RESULTS_DIR results)

Build and run your tests, and then invoke the convert target. A results folder is created that contains the converted test and code profiling results files in .pstestr and .psprof formats.

Input Arguments

collapse all

Name of the target that you must invoke to convert test and code profiling results to standard Polyspace Test formats.

One or more space-separated paths to:

  • Test result files in machine-readable (.mrf) or XML format. If you attempt to convert XML test results, make sure that the XML format is either the Polyspace Test XML format or the GoogleTest format.

  • Code profiling result files in binary (.bin) format.

Path to folder where the converted result files are stored, specified as a string.

Name used for the generated results files, specified as a string.

Additional conversion options that CMake forwards to polyspace-test -convert.

Version History

Introduced in R2025a