-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GTest #11506
Conversation
We meet again Gtest... |
Many changes not related to Gtest in here? |
…pendency [CI] Add support for importing runtime dependencies in gtest test suites
Refactor of some aux testing files
Hi @KratosMultiphysics/technical-committee can someone make a final review to this? As far as I am concern seems to be working well for all the CI external to CIMNE as well as our in house CI. |
@KratosMultiphysics/technical-committee approves this PR as it passes all the tests and provides mechanisms to handle diverse usage of the cpp tests in Kratos. |
Gtest won... |
📝 Description
Implementation of GTests.
Depending on:
Tasks
ubuntu-intel
reporting exit code as valid, and tests reporting false positives.Related
Kernel
Kernel changes are being discussed in separate PR's (#12281, #12306). This PR enabled the de-registration of components.
Testing Mechanism
All cpp can now be run directly from
bin/Release/tests/[SuiteName]
. In order to tests and debug there are several new options like:--gtest_filter="foo"
: To filter tests by name. Accepts wildcards.--gtest_break_on_failure
: To tell to stop in the first failure--gtest_catch_exceptions=0
: To prevent from capturing exepctions and be able to hook gdb directly on the faulty instructionComplete list can be found in the gtest documentation.
Tests als can be run through the testing scripts as usual:
testing/run_python_tests.py
testing/run_python_mpi_tests.py
testing/run_cpp_tests.py
testing/run_cpp_mpi_tests.py
Compilation Targets
Tests are now compiled in the majority of the cases with the
kratos_add_gtests
macro. As example:This macro accepts several options:
TARGET
: The target name of the library you will tests. In 99% this will beKratos[your_app_name]Core
. It will create aKratos[your_app_name]CoreTest
as result.SOURCES
: The list of the cpp files containing your tests and possible utilities needed by them. From now on we will not accept testing utilities as part of the core libraries in order to reduce the weight of the binaries.USE_MPI
: Added this flag if you target depends on MPI (MPICore, Trilinos, MPIExtensions, etc...)USE_CUSTOM_MAIN
: Add this flag if you have defined a custom main for your tests. In this PR this flag is enabled for most of the applications as a transition mechanism to keep the PR as small as possible. More in the transition section.There are new several compilation targets as a result of the changes in the tests:
In general you should not bother about those unless you want to do special things with your applications.
Transition Changes
Due to some changes in the structure of how the targets are compiler, tests no longer depend on the
testing
sources from Kratos. Specifically a change that will be required is to change "include/testing.h" to an include of you application testing suit.As this would imply changing all testing sources from Kratos in a single PR, most of applications have a transition solution in which a generic suit is defined in the kernel and the includes are the same. A placeholder is provided as well which will need to be changed to the final solution.
StructuralMechanics, Geomechanics, CoSimulationApplication and MappingApplication have the new mechanism in which the suite is included directly from the application. We expect to replace the rest of applications in future PR once this is merged.
🆕 Changelog