Tips: Generalize analyses for several architectures

TrustInSoft CI Analyzer is able to simulate several architectures but only one architecture can be used at a time. It means you need to define as many analyses in your Analyses configuration as architectures you want to verify with TrustInSoft CI.

The first solution would be to copy/paste your existing analyses configuration and modifying the "machdep"value by hand. However this solution does not scale well...

Another solution would be to use the Build preparation stage to generate the Analyses configuration for all the different architecture you want.

First, move your existing .trustinsoft/config.json to another file (such as .trustinsoft/orig_config.json):

.trustinsoft/orig_config.json
[
  {
    // Test shift values 7 and -3
    "files": [ "../main.c", "../caesar.c" ],
    "cpp-extra-args": "-I .."
  },
  {
    "name": "Test from program inputs",
    "files": [ "../main.c", "../caesar.c" ],
    "cpp-extra-args": "-I ..",
    "main": "main_with_input",
    "val-program-name": "a.out",
    "val-args": "|People of Earth, your attention please|7"
  }
]

Then, create a new .trustinsoft/prepare.sh script (or adapt your existing one with the following script):

Modify the MACHDEPSvariable to add the list of architectures to use for all analyses defined in .trustinsoft/orig_config.json.

Everything is now ready to be analyzed : commit these new files and run a new build to see the list of analyses for all defined architectures!

To easily identify the architecture used, the analysis name is also updated by the script to display the name of the architecture:

Last updated