User Tools

Site Tools


battery:addtestgitlab

Test battery - New method

This new test battery consists of a large number of simulations that are directly implemented in Gitlab: whenever a new push is made, the continuous integration pipeline launches a build phase and then a test phase. If everything went right, the merge is possible. Otherwise, the user is required to correct their mistake before being able to merge. This improves the robustness of the code and avoids mistakes.

Implemented by: Arthur Fanara, 2025

How does it work ?

Flowchart

Gitlab's Continuous Integration (CI) is launched through the file .gitlab-ci.yml in which two steps are defined:

  1. A build phase that generates, in Unix, the Prepro.exe, Lagamine.exe and Select.exe. This gives a first information on the state of the code.
  2. A test phase that launches as many tests as implemented. It uses three .sh files:
    • run_tests.sh: this file cycles through the $CI_PROJECT/Tests/ folders in order to run each test. The prepro and lagamine are run for each test, then the .ipe, .ipn and .ipr are compared with the reference results stored in the folder ExpectedResults:
      • Matching: lines are paired by (time = column 3, node/element = column 4, occurrence). Only the time steps present in BOTH files are compared. Extra steps (e.g. sub-steps after a non-convergence) are ignored and reported in an INFO line.
      • Error: for each value from column 5 onwards, scale = max(|x|, |y|, REL_FLOOR*max|column|, NOISE_REL*max|file|, abs_tol) and diff = |y - x| / scale, where x is the computed value, y the expected one, max|column| is taken over both files and max|file| over all columns >= 5.
      • Defaults: tolerance 3 %, REL_FLOOR = 1e-6, NOISE_REL = 1e-10, abs_tol = 1e-7. REL_FLOOR and NOISE_REL can be overridden as environment variables.
      • Output: for each file, OK or ECHEC with the maximum error, time, column, computed and expected values. An empty expected file (header only) is reported as INFO, not as a failure.
      • Failures: a failure does not stop the battery. All tests are run, the list of failures is printed at the end, and the job then exits with an error, so the merge is blocked.
    • run_prepro.sh: this file calls the newly generated prepro.exe for the test case.
    • run_lagamine.sh: this file calls the newly generated lagamine.exe for the test case. The .ipe, .ipn, .ipr, .log and .out are generated and exported in the artifacts of Gitlab, for further referencing. The simulations are run sequentially as not all routines allow parallelisation at the moment.

If one of the steps goes wrong, the job fails and the user is not allowed to merge their modification.

Tests

The folder 'Tests' contains all the tests.

Each test is in a separate subfolder named with the same name as the test defined in “Test_battery.txt”, preceded by its number. For example, 26_HYPOFE2_KFLU1 is the 26th test in the battery, and it verifies the integrity of the law HYPOFE2 with parameter KFLU1.

In this test subfolder, there are:

  1. The necessary files to run the prepro and lagamine: .DAT, .LAG, .PRI, .DEP, .LIC, and so on.
  2. A subfolder named “ExpectedResults” in which the result files are: the .ipn, .ipe and .ipr.

No other file should be found in this subfolder.

The ExpectedResults must be produced with exactly the files of the test folder (same .LAG, same final time).

How to add your own test to the battery

Creating your test

In order to ensure that your developments in the Lagamine code will keep functioning properly, it is highly recommended that you add one or several tests specific to the law(s) or element(s) you use and develop.

To test a material law or an element, you should design a simple test, using only 1 element when possible. Preferably, your test should not take more than a few seconds to run. If you need to test something more complex, you can also create a “Big” test. However, the total number of Big tests should be limited to avoid excessive computational times for the whole test battery.

Once you have designed your test and created the necessary simulation files, you must identify the important variables that indicate whether your law/element is behaving as it should.
These values can be obtained via the *.ipe result file.

Be sure to print out the values you want to check at the time step(s) you see fit.
To define the time steps at which you want a printing, you can use ILSAV = 1 or 2 in the ex.dat file.
Check Appendix 1: Printing options and Appendix 9: Printing files for more info about printing files.

Adding your test to the battery

To add a new test to the battery, you should:

  • Add the new test to the list of tests.
  • Add the folder containing your test to the test battery directory.
battery/addtestgitlab.txt · Last modified: 2026/11/19 10:54 by arthur