Skip to content

Tests

Available Tests

Compile Tests

All macros should be able to compile. This way we test, if given macro contains all necessary headers, that it links to relevant (MpdRoot's) libraries, and that functions/classes used are up to date. This tests are always enabled. Each macro should contain main function. If macro is usually called by another macros and can't contain main, then external source file with main will be added to test build.

Run Tests

We run compiled macros with given parameters and check whether they pass. If necessary, they can run with external (large) input files. This option is enabled via -DENABLE_TESTS option. To use large external files, -DMPDROOT_DATA pointing to respective git has to be provided during configuration of CMake project.

Unit Tests

Also enabled via -DENABLE_TESTS option, but are added only if Catch2 package (module add Catch2) can be found.

Sometimes we need large files to test certain macros. In order to keep basic MpdRoot repository of reasonable size, all large (input/output) files have been moved to its designated MpdRoot data repository. To use the given data in tests, check out the repository and provide path to the repository either using environment variable MPDROOT_DATA or by setting constant of the same name in configuration step (-DMPDROOT_DATA=/path/to/mpdroot/data/). By default large files are not downloaded, therefore read information in the given repository and download necessary files.

Running Tests

Only Run and Unit rests can be controlled. Compile tests run automatically as a part of build process. After successfully configuring MpdRoot and compiling it the following options are available:

command output provided
ctest --print-labels list of possible [group]s of tests to run
ctest -N list all possible tests (-N means dry run, by adding -N to any command bellow, you will see, which tests will run)
ctest -L [group] -N list all tests in group
ctest run all tests (may be long)
ctest -L [group] run all tests in group
ctest -LE [group] run all tests except for group

Most groups are same as names of respective libraries in lowercase. Special groups are:

group meaning
fast tests running fast (<1s)
slow tests running slowly (usually > 15s)
macro tests involving executing compiled macros using CTest framework
unit tests using Catch2 framework testing small portions of c++ code

Large Files

Sometimes we need large files to test certain macros. In order to keep primary MpdRoot repository of reasonable size, all large (input/output) files have been moved to designated MpdRoot data repository. To use the given data in tests, check out the repository and provide path to the repository either using environment variable MPDROOT_DATA or by setting constant of the same name during configuration step (-DMPDROOT_DATA=/path/to/mpdroot/data/). By default large files are not downloaded, therefore read information in the given repository and download necessary files.


Last update: May 19, 2026