# Tips: Generalize analyses for several architectures

{% hint style="danger" %}
This tip can only be achieved with a **Committed configuration**. See the [Configuration files](/configuration-file.md) section to learn more about the different kinds of configuration.
{% endhint %}

{% hint style="success" %}
All examples in this section can be replayed with our [demo-caesar](https://github.com/TrustInSoft-CI/demo-caesar) repository, used for our [Introduction tutorial](/tutorial.md). Feel free to fork this repository to try it by yourself.
{% endhint %}

TrustInSoft CI Analyzer is able to simulate [several architectures](/reference/supported-architectures.md) but only one architecture can be used at a time. It means you need to define as many analyses in your  [Analyses configuration](/configuration-file/analyses-configuration-file.md) 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](/configuration-file/build-preparation-script.md) to generate the [Analyses configuration](/configuration-file/analyses-configuration-file.md) for all the different architecture you want.

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

{% code title=".trustinsoft/orig\_config.json" %}

```javascript
[
  {
    // 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"
  }
]
```

{% endcode %}

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

{% code title=".trustinsoft/prepare.sh" %}

```bash
#!/bin/bash

set -e

readonly INPUT_FILE="orig_config.json"
readonly MACHDEPS=(
  x86_32
  x86_64
  gcc_x86_32
  gcc_x86_64
)

test -e "$INPUT_FILE" || { echo "$INPUT_FILE not found"; exit 1; }

results=()

for machdep in "${MACHDEPS[@]}"; do
  # Use "minify --type js" to pre-process comments. Then, for each
  # object, add the "machdep" field and update the "name" field.
  res="$(minify --type js "$INPUT_FILE" | \
         jq \
           --arg mach "$machdep" \
           'map(. + { "machdep": $mach }) |
            to_entries |
            map(
              if getpath([ "value", "name" ]) != null then
                .value + { "name": (.value.name + " - " + $mach) }
              else
                .value + { "name": ("Analysis " + (.key + 1 | tostring) + " - " + $mach) } end)')"
  results+=( "$res" )
done

# Gather all configuration objects into a single one.
printf '%s\n' "${results[@]}" | jq '.[]' | jq -s '.' > config.json
```

{% endcode %}

Modify the `MACHDEPS`variable 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!&#x20;

{% hint style="info" %}
To easily identify the architecture used, the analysis name is also updated by the script to display the name of the architecture:
{% endhint %}

![](/files/-MeeqFhINo4VdpkLhUeW)

&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ci.trust-in-soft.com/configuration-file/tips-generalize-analyses-for-several-architectures.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
