This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM® and OpenCFD® trade marks.
This is a unit/integration testing framework to help test-proof new OpenFOAM code (might be too late for the OpenFOAM library itself). This repository will always work with the latest versions of the main three OpenFOAM forks: ESI OpenCFD's, Foundation version and Foam-Extend.
If you intend to write cross-forks code, this can help you maintain your sanity. You can just keep branches for each fork on your code's repository and invoke CI on them with the help of this testing framework.
The Alltest script loops through the OpenFOAM cases and runs corresponding
test cases (for directories it finds under tests that contain a Make
folder)
- both in serial and in parallel.
You can use this to your advantage as you don't need to include this repo into your code base:
- In your library's repo, write tests the way you like;
ship them with their own
Make
directory to compile the test driver (see example tests) - Set the
FOAM_FOAMUT
environment variable to your local clone offoamUT
repository - In your CI workflows, checkout this repository, set
FOAM_FOAMUT
to its path, and either:- symlink your tests somewhere under
tests
ln -s /path/to/your/tests/myLibTests tests/myLibTests
- or set
FOAM_FOAMUT_TESTS
to yourtests
folderexport FOAM_FOAMUT_TESTS=/path/to/your/tests
- symlink your tests somewhere under
- Do the same for your OpenFOAM cases if you have any (only a simple cavity case is provided by default).
Put these under
cases
. - Run
./Alltest
to compile and run your tests on your cases.
Head to the wiki to read few more words about this framework. There is also a FAQ there.
Ease of use and portability across OpenFOAM forks are the main focus of this framework. As long as your contribution doesn't hinder one of those two objectives; it will be welcomed! And PRs against master are the way to go.