Run the tests¶
FORGE's tests use Catch2. Each backend has its own test program, written to the top of the build directory.
| Program | Build it when | Tests |
|---|---|---|
cpu_tests |
always | The CPU library, plus command-line tests that run the _cpu reconstruction programs |
metal_tests |
macOS with the Metal backend | The CPU library and the Metal paths |
cuda_tests |
CUDA_COMPUTE=ON |
The CUDA backend. cpu_tests never compiles CUDA code, so this is the only program that tests it. |
ismrmrd_tests |
Linux | Writing ISMRMRD files |
Build and run the CPU tests¶
cmake --build build --target cpu_tests
./build/cpu_tests
Building cpu_tests also builds the _cpu reconstruction programs, because some tests run them.
Skip the slow tests¶
Some tests need external data or take a long time. CI leaves them out with tag filters, and you can do the same:
./build/cpu_tests '~[Benchmark]' '~[ISMRMRD]' '~[Spiral3D]' '~[directRecon]' \
'~[SENSE_bench]' '~[pcSENSE_bench]' '~[TimeSeg_bench]' '~[Gdft_bench]'
The same filters work for metal_tests.
Run the GPU tests¶
On a Mac:
cmake --build build --target metal_tests
./build/metal_tests '~[Benchmark]'
On Linux with CUDA:
cmake --build build --target cuda_tests
./build/cuda_tests
Run one group of tests¶
Pass a tag, or a test name in quotes:
./build/metal_tests "[metal_vecops]"
./build/cpu_tests "PCG solver converges on noiseless Cartesian Gdft problem"
--list-tags prints every tag and --list-tests every test.