1[Japanese Version](./README.ja.md)
2
3Run test
4---------
5
6Use [ctest][ctest].
7We assume here that FrontISTR project is built by [cmake][cmake]:
8
9```
10git clone https://gitlab.com/FrontISTR-Commons/FrontISTR
11cd FrontISTR   # we call here as FRONTISTR_HOME
12cmake . -Bbuild
13cmake --build build/ -j $(nproc)
14```
15
16Then `fistr1` and other executables are built in `${FRONTISTR_HOME}/build`.
17You can run test on this directory:
18
19```
20cd build/
21ctest
22```
23
24### Labels of tests
25
26Tests are managed by ctest's label. There are 4 labels about parallelization:
27
28| label | OpenMP | MPI |
29|:------|:------:|:---:|
30|serial | OFF    | OFF |
31|openmp | ON     | OFF |
32|mpi    | OFF    | ON  |
33|hybrid | ON     | ON  |
34
35To execute labeled tests, please run [ctest][ctest] with `-L` (`--label-regex`) flag:
36
37```
38ctest -L mpi
39```
40
41In addition to these parallelization labels, there are labels for "target".
42As described below, [cmake][cmake] seeks tests in this directory,
43and put a label `analysis/eigen/exK` to tests for `${FRONTISTR_HOME}/tests/analysis/eigen/exK` for example.
44To run tests on this directory, please use this label:
45
46```
47ctest -L analysis/eigen/exK
48```
49
50Because `-L` flag can select by partial match,
51
52```
53ctest -L analysis
54```
55
56will executes all tests in `${FRONTISTR_HOME}/tests/analysis`
57
58### Configure test output
59
60As a general technique of [ctest][ctest],
61
62```
63ctest -V
64```
65
66displays all output of test processes, and
67
68```
69ctest --output-on-failure
70```
71
72displays the output of failed tests. See `ctest -h` for detail.
73
74Add test
75---------
76
77[cmake][cmake] seeks mesh data (`*.msh`) from `${FRONTISTR_HOME}/tests/`, and then registers it as a test target.
78This target compares the result of `fistr1` of current build with reference build,
79and tests the difference is enough small.
80In order to append a new test, you should
81
821. Create a directory under `${FRONTISTR_HOME}/tests`
832. Put `*.msh` and `*.cnt` files
843. Generate reference result by `${FRONTISTR_HOME}/tests/create_reference.sh`
854. and Confirm this result is correct by your eye
86
87Be sure that because `create_reference.sh` uses executable binary `${FRONTISTR_HOME}/build/fistr/fistr1` by default, you have to build it in advance.
88Be sure that because `create_reference_docker.sh` uses official release image, you need the authority for execution of [Docker][docker].
89
90[cmake]: https://cmake.org/cmake/help/latest/manual/cmake.1.html
91[ctest]: https://cmake.org/cmake/help/latest/manual/ctest.1.html
92[docker]: https://www.docker.com/
93