Polyspace in Jenkins. How to reduce the size of the generated options file?

4 views (last 30 days)
Alessandro Samori
Alessandro Samori on 13 Oct 2021
Commented: Anirban on 18 Oct 2021
We are using Polyspace with the automation server Jenkins. The method to generate automatically a Polyspace options_file, is to use the command Polyspace-configure.
The line, in the makefile, used to call the command is the following:
$(base_dir)/polyspace/bin/polyspace-configure -output-options-file $(generated_options) -no-project make -B build -f linux.makefile
In Jenkinsfile, there is the command that calls a target of the makefile which contains the command polyspace-bug-finder-server. The polyspace-bug-finder-server has the generated options-file as input.
We can see that this generated file contains the command “-options-for-sources” for each file given as a source. Each line is very long because it contains a lot of inclusions and MACROs for each file. There are around 500 source files and for each file, there are about 200 “-I” inclusions and 100 of “-D” command for MACROS.
We think that these long lines cause slow execution of the Jenkins step when it uses the generated file (-options-file) with the bug finder analysis.
The same MACROs are in all the "-options-for-sources" lines. Many of the included folders are common with many "-options-for-sources".
Is there an option of polyspace-configure or other commands, that can help us to reduce the size of the generated file lines? I mean, to collect the common inclusions in a unique line for example.

Accepted Answer

Anirban
Anirban on 13 Oct 2021
Edited: Anirban on 13 Oct 2021
You can add the option -merge-common-options to the polyspace-configure line. This will take all the -options-for-sources arguments and put them in one pile (and remove the duplicates). However, there is a caveat: all the -options-for-sources arguments have to be the exact same for them to be merged into one pile.
This option usually works in a lot of contexts despite the caveat because all files to analyze are usually built with the same macro definitions and includes. Therefore, all -options-for-sources arguments might be just the same.
Differences between -options-for-sources arguments occur, for instance, when you build a project with files other than just the sources. For instance, you might be building test files, which then get added to the Polyspace options file (with -options-for-sources arguments that are different from the sources). In this case, you can use the options -exclude-sources/-include-sources to prevent unnecessary files from being added and also use -merge-common-options to merge all -options-for-sources arguments into one pile without duplicates. See polyspace-configure page for more information on the options.
  4 Comments
Anirban
Anirban on 18 Oct 2021
You can contact MathWorks Technical Support to help you simplify the generated file. If all the macros are the same, it might make sense to add separate -D -s towards the beginning of the options file (one -D per line, no semicolon needed). The include folders are more difficult since the order of the include folders matters. MathWorks Technical Support can take a look at the options file you have currently and suggest solutions.

Sign in to comment.

More Answers (0)

Products


Release

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by