Neko
0.9.99
A portable framework for high-order spectral element flow simulations
|
Neko uses the software pFUnit for unit testing. To install the software you can use the following commands, in which you should just set the desired installation path
You will now have a directory called PFUNIT-4.4 in your install path.
To use pFUnit with Neko, we need to specify its location during the configure
phase of the build. The following configuration is given here as an example, where again you need to provide the path
Make sure that in the output you see it says pFUnit ... yes
at some point.
To run the tests you should execute
This will first compile the software and the tests, and then execute them. In the end you should get a nice list of tests that were run and a summary, which hopefully says that all tests have passed!
The first step is of course to read the documentation for pFUnit to understand how it works. It is up to you to learn how to write .pf
files. Here, we only cover how to incorporate the test into the Neko build system.
The tests are located in the tests
folder. Unlike some other software, the structure of the tests
folder does not follow that of src
. Instead each folder loosely corresponds to a single class or sometimes a single abstract class and its children (see the stack
folder, for example).
We now go through the steps of adding a test. The instructions will differ somewhat depending on whether you test uses MPI or not.
tests
, corresponding to the classes that will be tested..pf
files you've written inside that folder.Makefile.in
file from some over test folder. If your test does not use MPI, you can copy from e.g. hex
, otherwise take it from field
. As usual, the Makefile.in
will turn into a Makefile
during the configure
phase of the build.Makefile.in
looks very much like the Makefile
examples in the documentation of pFUnit.check
target should be changed to the name of your test. If your test does not use MPI, name it the same as the name of the folder + _test
. If you need MPI, then don't use test
, but rather something else, like _suite
._TESTS
, _OTHER_LIBRARIES
, and the other pFUnit stuff should be prefixed with the name selected above. Similarly with the eval
statement.clean
target, also put the same name as in check
.field/field_test
to start with, which looks like this ./field/field_suite
to the name of the directory for your test and the name of the check
target in the Makefile.in
.tests/unit/Makefile.am
. This file contains three lists.SUBDIRS
, to which you should add the directory with your tests.TESTS
, here you should add the file, which ends with _test
. If you followed the conventions above it will be the output from pFUnit for a simple test, or the runner you created in the case of an MPI test.EXTRA_DIST
. Here, you should add all your .pf
files. That is it for a simple test, but if you use MPI you should also copy the entry you made in TESTS
to this list. Again, you can use field_test
as an example.configure.ac
file in the root folder of neko
. Find # Config tests
line and the AC_CONFIG_FILES
list below it. Add the path to a Makefile
(note, no .in
!!) in your test folder.tests/unit/.gitignore
file. This helps keeps the version controlled file list unpolluted.