Update tests, including Catch version
This MR updates the testing scripts that were made by the CB-Geo research group on their branch (develop
).
What needed to be done
- update the testing library (
Catch
). It used to be located in theexternal
directory, but now requires to be installed withapt-get install catch2
. This was necessary to avoid compilation errors. - update the usage of many functions according to the changes we made on our fork
- solve assertion issues, presumably brought by
Catch2
. These included 1) the assertions that a value is 0 does not work like any other floats (see thisCatch2
issue for more details) and 2) the slight increase of some tolerance values with which tests didn't work as expected (see for instance tests intests/materials/mohr_coulomb_test.cc
) - solve issues related to the MPI usage. Some tests assumed the code was compiled using MPI, they are now performed only if MPI is used.
- adapt the usage of
compute_updated_position
, which does not update the particle velocity anymore (now it iscompute_particle_velocity
job)
What remains to do
-
make it so tests do not raise errors. These errors are to be expected since functions are not used in the same context than during a simulation, and should thus be ignored. I don't like that, it is confusing and floods the output, so I will try to solve itDONE -
add tests for new features from our forkDONE -
improve the testing handling in theDONE. Maybe also try, in this file, to import scripts recursively rather than one by one explicitly (there must be a better way) EDIT: turns out the latter is possible but not recommended, so I'm leaving this as isCMakeLists.txt
-
add testing to the CI pipelineDONE -
updateDONEREADME.md
with new instructions: 1)necessity of installing(only if the user wants to run the tests) 2) instruction on how to run the testsCatch2
with apt -
clean up the output of the tests (by adding an option to write the output to a file ?)DONE -
organize better the input files necessary (and generated) for the tests, currently at the root of the build directoryDONE
How to run the tests
As for now (this should change soon), to run the tests one has to compile with the CMake option WITH_TESTS
set to ON (e.g. using -DWITH_TESTS=ON
with cmake
), and then execute the tests executable, currently named ${EXECUTABLE_NAME}-test
(default mpm-test
) and only located in the build directory (it is not installed in INSTALL_DIR, and depends on files in the build directory). No error should be raised, but a fairly large amount of output is to be expected. At the end, one should see:
===============================================================================
All tests passed (20462 assertions in 70 test cases)
Edited by Sacha Duverger