メインコンテンツ

polyspace.test.build

(Python) Build project containing C/C++ sources and tests

Since R2024a

Description

buildResults=polyspace.test.build(proj) builds a project proj containing C/C++ sources and tests (optional).

If an error occurs during build, the function throws an exception of type polyspace.ErrorWithLog. (since R2026a)

buildResults=polyspace.test.build(proj, otherOptions) builds a project using additional options specified in otherOptions.

Input Arguments

expand all

Name of the polyspace.project.Project object that contains the code and tests that you are building.

Example: myProject=polyspace.project.Project(newProj.psprjx)

Enable debugger, specify new build directory, overwrite current profiling selection.

ParameterDescription
EnableDebugger=True | False

Inspect the test executable generated by Polyspace Test using a supported debugger. The debugger is attached to the specified process and adds breakpoints in selected tests. For more information on supported debuggers, see Debug Test Failures from Polyspace Platform User Interface.

Note that you cannot debug tests in a project with profiling enabled.

ForceRebuild=True | False

Force a full build of the source files instead of an incremental build.

This parameter is set to False by default. As a result, a project build takes into account previous build information and rebuilds only those sources that changed since the previous build. Some changes in project configuration such as changes in processor information might not trigger a rebuild at all. To force a build of all sources, set this parameter to True.

BuildFolder=folderPath

Specify the path folderPath where Polyspace® stores the build artifacts. You can specify the absolute path or the path relative to your working directory.

By default, Polyspace stores the build artifacts in a polyspace_artifacts subfolder of the project folder. To get this path programmatically from a polyspace.project.Project object proj, enter:

artifactsDir = os.path.join(os.path.dirname(proj.Path), "polyspace_artifacts")

ProfilingSelection=polyspace.test.ProfilingSelection Object

Specify the profiling mode to use instead of the profiling mode specified in the active test configuration of the project. The values of this option are:

  • polyspace.test.ProfilingSelection.NONE(default) — Calculate none of the code profile metrics.

  • polyspace.test.ProfilingSelection.COVERAGE — Calculate the code coverage metrics. You can select which code coverage metrics to calculate by using the option proj.ActiveTestConfiguration.CoverageOptions object.

  • polyspace.test.ProfilingSelection.EXECUTION — Calculate how much time the callable entities in your code take to execute.

  • polyspace.test.ProfilingSelection.STACK — Calculate stack memory usage of the callable entities.

    Polyspace Test™ does not support calculating the memory use of external tests.

  • polyspace.test.ProfilingSelection.SANITIZER – Calculate code sanitizer profiling results.

Example: polyspace.test.build(myProject,EnableDebugger=True, BuildFolder="/usr/local/customBuild")

Output Arguments

expand all

Since R2026a

Results of project build, returned as a polyspace.test.BuildResults object. For more information, see polyspace.test.BuildResults.

Version History

Introduced in R2024a

expand all