Main Content

run

Run a Polyspace analysis

Syntax

run(proj, product)

Description

status = run(proj, product) runs a Polyspace® Bug Finder™ or Polyspace Code Prover™ analysis using the configuration specified in the polyspace.Project object proj. The analysis results are also stored in proj.

Input Arguments

expand all

Polyspace project with configuration and results, specified as a polyspace.Project object.

Type of analysis to run.

Output Arguments

expand all

Status of analysis. If the analysis succeeds, the status is false. Otherwise, it is true.

The analysis can fail for multiple reasons:

  • You provide source files that do not exist.

  • None of your files compile. Even if one file compiles, unless you set the property StopWithCompileError to true, the analysis succeeds and returns a false status.

There can be many other reasons why the analysis fails. If the analysis fails, in your results folder, check the log file. You can see the results folder using the Configuration property of the polyspace.Project object:

proj = polyspace.Project;
proj.Configuration.ResultsDir
The log file is named Polyspace_R20##n_ProjectName_date-time.log.

Examples

expand all

Run a Polyspace Bug Finder analysis on the demo file numerical.c. Configure these options:

  • Specify GCC 4.9 as your compiler.

  • Save the results in a results subfolder of the current working folder.

proj = polyspace.Project

% Configure analysis
proj.Configuration.Sources = {fullfile(polyspaceroot, 'polyspace', ... 
    'examples', 'cxx', 'Bug_Finder_Example', 'sources', 'numerical.c')};
proj.Configuration.TargetCompiler.Compiler = 'gnu4.9';
proj.Configuration.ResultsDir = fullfile(pwd,'results');

% Run analysis
bfStatus = run(proj, 'bugFinder');

% Read results
bfSummary = proj.Results.getSummary('defects');

Version History

Introduced in R2017b