-post-analysis-command)Specify command or script to be executed after analysis
Specify a command or script to be executed after the analysis.
User interface (desktop products only): In your project configuration, the option is on the Advanced Settings node.
Command line and options file: Use the option
-post-analysis-command. See Command-Line Information.
Create scripts for tasks that you want performed after the Polyspace® analysis.
For instance, you want to be notified by email that the Polyspace analysis is over. Create a script that sends an email and use this option to execute the script after the Polyspace analysis.
No Default
Enter full path to the command or script, or click
to navigate to the location
of the command or script. After the analysis, this script is executed.
The script is executed in the Polyspace results folder. In your script, consider the results folder as the current folder for relative paths to other files.
For a Perl script, in Windows®, specify the full path to the Perl executable followed by the full path to the
script. For example, to specify a Perl script send_email.pl that sends an
email once the analysis is over, enter
. Here,
polyspaceroot\sys\perl\win32\bin\perl.exe
<absolute_path>\send_email.pl is the location of the current
Polyspace installation, such as polyspacerootC:\Program Files\Polyspace\R2019a\, and
<absolute_path> is the location of the Perl script.
If you perform verification on a remote server, after verification, the software executes your command on the server, not on the client desktop. If your command executes a script, the script must be present on the server.
For instance, if you specify the command, /local/utils/send_mail.sh,
the Shell script send_email.sh must be present on the server in
/local/utils/. The software does not copy the script
send_email.sh from your desktop to the server before executing the
command. If the script is not present on the server, you encounter an error. Sometimes,
there are multiple servers that the MATLAB® Job Scheduler can run the verification on. Place the script on each of the
servers because you do not control which server eventually runs your verification.
To test the use of this option, run the following Perl script from a folder containing a
Polyspace project (.psprj file). The script parses the latest
Polyspace log file in the folder Module_1\CP_Result and writes the
current project name and date to a file report.txt. The file is saved in
Module_1\CP_Result.
foreach my $file (`ls Module_1\\CP_Result\\Polyspace_*.log`) {
open (FH, $file);
while ($line = <FH>) {
if ($line =~ m/Ending at: (.*)/) {
$date=$1;
}
if ($line =~ m/-prog=(.*)/) {
$project=$1;
}
}
}
my $filename = 'report.txt';
open(my $fh, '>', $filename) or die "Could not open file '$filename' $!";
print $fh "date=$date\n";
print $fh "project=$project\n";
close $fh;
|
In Linux®, you can specify the Perl script for this option.
In Windows, instead of specifying the Perl script directly, specify a
.bat file that invokes Perl and runs this script. For instance, the
.bat file can contain the following line (assuming that the
.bat file and .pl file are in the Polyspace project folder). Depending on your MATLAB installation, change the path to perl.exe
appropriately.
"C:\Program Files\MATLAB\R2018b\sys\perl\win32\bin\perl.exe" command.pl |
Run Code Prover. Check that the folder Module_1\CP_Result contains the
file report.txt with the project name and date.
Parameter: -post-analysis-command |
| Value: Path to executable file or command in quotes |
| No Default |
Example in Linux (Bug Finder):
polyspace-bug-finder -sources |
Example in Linux (Code Prover) :
polyspace-code-prover -sources |
Example in Linux (Bug Finder Server):
polyspace-bug-finder-server -sources |
Example in Linux (Code Prover Server):
polyspace-code-prover-server -sources |
Example in Windows:
polyspace-bug-finder -sources |
Note that in Windows, you use the full path to the Perl executable.