@@ -38,7 +38,7 @@ following criteria must be satisfied for all proposed changes:
3838
3939- Changes have a clear purpose and are useful.
4040- Compiles under all conditions (MPI, OpenMP, HDF5, etc.). This is checked as
41- part of the test suite (see ` test_compile.py `_) .
41+ part of the test suite.
4242- Passes the regression suite.
4343- If appropriate, test cases are added to regression suite.
4444- No memory leaks (checked with valgrind _).
@@ -91,6 +91,133 @@ features and bug fixes. The general steps for contributing are as follows:
91916. After the pull request has been thoroughly vetted, it is merged back into the
9292 *develop * branch of mit-crpg/openmc.
9393
94+ .. _test suite :
95+
96+ OpenMC Test Suite
97+ -----------------
98+
99+ The purpose of this test suite is to ensure that OpenMC compiles using various
100+ combinations of compiler flags and options, and that all user input options can
101+ be used successfully without breaking the code. The test suite is comprised of
102+ regression tests where different types of input files are configured and the
103+ full OpenMC code is executed. Results from simulations are compared with
104+ expected results. The test suite is comprised of many build configurations
105+ (e.g. debug, mpi, hdf5) and the actual tests which reside in sub-directories
106+ in the tests directory. We recommend to developers to test their branches
107+ before submitting a formal pull request using gfortran and intel compilers
108+ if available.
109+
110+ The test suite is designed to integrate with cmake using ctest _.
111+ It is configured to run with cross sections from NNDC _. To
112+ download these cross sections please do the following:
113+
114+ .. code-block :: sh
115+
116+ cd ../data
117+ python get_nndc.py
118+ export CROSS_SECTIONS=< path_to_data_folder> /nndc/cross_sections.xml
119+
120+ The test suite can be run on an already existing build using:
121+
122+ .. code-block :: sh
123+
124+ cd build
125+ make test
126+
127+ or
128+
129+ .. code-block :: sh
130+
131+ cd build
132+ ctest
133+
134+ There are numerous ctest _ command line options that can be set to have
135+ more control over which tests are executed.
136+
137+ Before running the test suite python script, the following environmental
138+ variables should be set if the default paths are incorrect:
139+
140+ * **FC ** - The command of the Fortran compiler (e.g. gfotran, ifort).
141+
142+ * Default - *gfortran *
143+
144+ * **MPI_DIR ** - The path to the MPI directory.
145+
146+ * Default - */opt/mpich/3.1-gnu *
147+
148+ * **HDF5_DIR ** - The path to the HDF5 directory.
149+
150+ * Default - */opt/hdf5/1.8.12-gnu *
151+
152+ * **PHDF5_DIR ** - The path to the parallel HDF5 directory.
153+
154+ * Default - */opt/phdf5/1.8.12-gnu *
155+
156+ * **PETSC_DIR ** - The path to the PETSc directory.
157+
158+ * Default - */opt/petsc/3.4.4-gnu *
159+
160+ To run the full test suite, the following command can be executed in the
161+ tests directory:
162+
163+ .. code-block :: sh
164+
165+ python run_tests.py
166+
167+ A subset of build configurations and/or tests can be run. To see how to use
168+ the script run:
169+
170+ .. code-block :: sh
171+
172+ python run_tests.py --help
173+
174+ As an example, say we want to run all tests with debug flags only on tests
175+ that have cone and plot in their name. Also, we would like to run this on
176+ 4 processors. We can run:
177+
178+ .. code-block :: sh
179+
180+ python run_tests.py -j 4 -C debug -R " cone|plot"
181+
182+ Note that standard regular expression syntax is used for selecting build
183+ configurations and tests. To print out a list of build configurations, we
184+ can run:
185+
186+ .. code-block :: sh
187+
188+ python run_tests.py -p
189+
190+ Adding tests to test suite
191+ ++++++++++++++++++++++++++
192+
193+ To add a new test to the test suite, create a sub-directory in the tests
194+ directory that conforms to the regular expression *test_ *. To configure
195+ a test you need to add the following files to your new test directory,
196+ *test_name * for example:
197+
198+ * OpenMC input XML files
199+ * **test_name.py ** - python test driver script, please refer to other
200+ tests to see how to construct. Any output files that are generated
201+ during testing must be removed at the end of this script.
202+ * **results.py ** - python script that extracts results from statepoint
203+ output files. By default it should look for a binary file, but can
204+ take an argument to overwrite which statepoint file is processed,
205+ whether it is at a different batch or with an HDF5 extension. This
206+ script must output a results file that is named *results_test.dat *.
207+ It is recommended that any real numbers reported use *12.6E * format.
208+ * **results_true.dat ** - ASCII file that contains the expected results
209+ from the test. The file *results_test.dat * is compared to this file
210+ during the execution of the python test driver script. When the
211+ above files have been created, generate a *results_test.dat * file and
212+ copy it to this name and commit. It should be noted that this file
213+ should be generated with basic compiler options during openmc
214+ configuration and build (e.g., no MPI/HDF5, no debug/optimization).
215+
216+ In addition to this description, please see the various types of tests that
217+ are already included in the test suite to see how to create them. If all is
218+ implemented correctly, the new test directory will automatically be added
219+ to the CTest framework.
220+
94221Private Development
95222-------------------
96223
@@ -108,10 +235,11 @@ from your private repository into a public fork.
108235.. _git : http://git-scm.com/
109236.. _GitHub : https://github.com/
110237.. _git flow : http://nvie.com/git-model
111- .. _test_compile.py : https://github.com/mit-crpg/openmc/blob/develop/tests/test_compile/test_compile.py
112238.. _valgrind : http://valgrind.org/
113239.. _style guide : http://mit-crpg.github.io/openmc/devguide/styleguide.html
114240.. _pull request : https://help.github.com/articles/using-pull-requests
115241.. _mit-crpg/openmc : https://github.com/mit-crpg/openmc
116242.. _paid plan : https://github.com/plans
117243.. _Bitbucket : https://bitbucket.org
244+ .. _ctest : http://www.cmake.org/cmake/help/v2.8.12/ctest.html
245+ .. _NNDC : http://http://www.nndc.bnl.gov/endf/b7.1/acefiles.html
0 commit comments