Merge branch 'ctests' into cdash

This commit is contained in:
Bryan Herman 2014-04-03 21:13:59 -04:00
commit 5eca3fbfe5
97 changed files with 661 additions and 202 deletions

View file

@ -10,7 +10,7 @@ as debugging.
.. toctree::
:numbered:
:maxdepth: 2
:maxdepth: 3
structures
styleguide

View file

@ -4,6 +4,296 @@
State Point Binary File Specifications
======================================
-----------
Revision 11
-----------
**integer(4) FILETYPE_STATEPOINT**
Flags whether this file is a statepoint file or a particle restart file.
**integer(4) REVISION_STATEPOINT**
Revision of the binary state point file. Any time a change is made in the
format of the state-point file, this integer is incremented.
**integer(4) VERSION_MAJOR**
Major version number for OpenMC
**integer(4) VERSION_MINOR**
Minor version number for OpenMC
**integer(4) VERSION_RELEASE**
Release version number for OpenMC
**character(19) time_stamp**
Date and time the state point was written.
**character(255) path**
Absolute path to directory containing input files.
**integer(8) seed**
Pseudo-random number generator seed.
**integer(4) run_mode**
run mode used. The modes are described in constants.F90.
**integer(8) n_particles**
Number of particles used per generation.
**integer(4) n_batches**
Total number of batches (active + inactive).
**integer(4) current_batch**
The number of batches already simulated.
if (run_mode == MODE_EIGENVALUE)
**integer(4) n_inactive**
Number of inactive batches
**integer(4) gen_per_batch**
Number of generations per batch for criticality calculations
*do i = 1, current_batch \* gen_per_batch*
**real(8) k_generation(i)**
k-effective for the i-th total generation
*do i = 1, current_batch \* gen_per_batch*
**real(8) entropy(i)**
Shannon entropy for the i-th total generation
**real(8) k_col_abs**
Sum of product of collision/absorption estimates of k-effective
**real(8) k_col_tra**
Sum of product of collision/track-length estimates of k-effective
**real(8) k_abs_tra**
Sum of product of absorption/track-length estimates of k-effective
**real(8) k_combined(2)**
Mean and standard deviation of a combined estimate of k-effective
**integer(4) cmfd_on**
Flag that cmfd is on
if (cmfd_on)
**integer(4) cmfd % indices**
Indices for cmfd mesh (i,j,k,g)
**real(8) cmfd % k_cmfd(1:current_batch)**
CMFD eigenvalues
**real(8) cmfd % src(1:G,1:I,1:J,1:K)**
CMFD fission source
**real(8) cmfd % entropy(1:current_batch)**
CMFD estimate of Shannon entropy
**real(8) cmfd % balance(1:current_batch)**
RMS of the residual neutron balance equation on CMFD mesh
**real(8) cmfd % dom(1:current_batch)**
CMFD estimate of dominance ratio
**real(8) cmfd % scr_cmp(1:current_batch)**
RMS comparison of difference between OpenMC and CMFD fission source
**integer(4) n_meshes**
Number of meshes in tallies.xml file
*do i = 1, n_meshes*
**integer(4) meshes(i) % id**
Unique ID of mesh.
**integer(4) meshes(i) % type**
Type of mesh.
**integer(4) meshes(i) % n_dimension**
Number of dimensions for mesh (2 or 3).
**integer(4) meshes(i) % dimension(:)**
Number of mesh cells in each dimension.
**real(8) meshes(i) % lower_left(:)**
Coordinates of lower-left corner of mesh.
**real(8) meshes(i) % upper_right(:)**
Coordinates of upper-right corner of mesh.
**real(8) meshes(i) % width(:)**
Width of each mesh cell in each dimension.
**integer(4) n_tallies**
*do i = 1, n_tallies*
**integer(4) tallies(i) % id**
Unique ID of tally.
**integer(4) tallies(i) % n_realizations**
Number of realizations for the i-th tally.
**integer(4) size(tallies(i) % scores, 1)**
Total number of score bins for the i-th tally
**integer(4) size(tallies(i) % scores, 2)**
Total number of filter bins for the i-th tally
**integer(4) tallies(i) % n_filters**
*do j = 1, tallies(i) % n_filters*
**integer(4) tallies(i) % filter(j) % type**
Type of tally filter.
**integer(4) tallies(i) % filter(j) % n_bins**
Number of bins for filter.
**integer(4)/real(8) tallies(i) % filter(j) % bins(:)**
Value for each filter bin of this type.
**integer(4) tallies(i) % n_nuclide_bins**
Number of nuclide bins. If none are specified, this is just one.
*do j = 1, tallies(i) % n_nuclide_bins*
**integer(4) tallies(i) % nuclide_bins(j)**
Values of specified nuclide bins
**integer(4) tallies(i) % n_score_bins**
Number of scoring bins.
*do j = 1, tallies(i) % n_score_bins*
**integer(4) tallies(i) % score_bins(j)**
Values of specified scoring bins (e.g. SCORE_FLUX).
*do j = 1, tallies(i) % n_score_bins*
**integer(4) tallies(i) % scatt_order(j)**
Scattering Order specified scoring bins.
**integer(4) tallies(i) % n_score_bins**
Number of scoring bins without accounting for those added by
the scatter-pn command.
**integer(4) source_present**
Flag indicated if source bank is present in the file
**integer(4) n_realizations**
Number of realizations for global tallies.
**integer(4) N_GLOBAL_TALLIES**
Number of global tally scores
*do i = 1, N_GLOBAL_TALLIES*
**real(8) global_tallies(i) % sum**
Accumulated sum for the i-th global tally
**real(8) global_tallies(i) % sum_sq**
Accumulated sum of squares for the i-th global tally
**integer(4) tallies_on**
Flag indicated if tallies are present in the file.
if (tallies_on > 0)
*do i = 1, n_tallies*
*do k = 1, size(tallies(i) % scores, 2)*
*do j = 1, size(tallies(i) % scores, 1)*
**real(8) tallies(i) % scores(j,k) % sum**
Accumulated sum for the j-th score and k-th filter of the
i-th tally
**real(8) tallies(i) % scores(j,k) % sum_sq**
Accumulated sum of squares for the j-th score and k-th
filter of the i-th tally
if (run_mode == MODE_EIGENVALUE and source_present)
*do i = 1, n_particles*
**real(8) source_bank(i) % wgt**
Weight of the i-th source particle
**real(8) source_bank(i) % xyz(1:3)**
Coordinates of the i-th source particle.
**real(8) source_bank(i) % uvw(1:3)**
Direction of the i-th source particle
**real(8) source_bank(i) % E**
Energy of the i-th source particle.
-----------
Revision 10
-----------

View file

@ -38,7 +38,7 @@ following criteria must be satisfied for all proposed changes:
- Changes have a clear purpose and are useful.
- Compiles under all conditions (MPI, OpenMP, HDF5, etc.). This is checked as
part of the test suite (see `test_compile.py`_).
part of the test suite.
- Passes the regression suite.
- If appropriate, test cases are added to regression suite.
- No memory leaks (checked with valgrind_).
@ -91,6 +91,81 @@ features and bug fixes. The general steps for contributing are as follows:
6. After the pull request has been thoroughly vetted, it is merged back into the
*develop* branch of mit-crpg/openmc.
.. _test suite:
OpenMC Test Suite
-----------------
The purpose of this test suite is to ensure that OpenMC compiles using various
combinations of compiler flags and options and that all user input options can
be used successfully without breaking the code. The test suite is based on
regression or integrated testing where different types of input files are
configured and the full OpenMC code is executed. Results from simulations
are compared with expected results. The test suite is comprised of many
build configurations (e.g. debug, mpi, hdf5) and the actual tests which
reside in sub-directories in the tests directory.
The test suite is designed to integrate with cmake using ctest_. To run the
full test suite run:
.. code-block:: sh
python run_tests.py
A subset of build configurations and/or tests can be run. To see how to use
the script run:
.. code-block:: sh
python run_tests.py --help
As an example, say we want to run all tests with debug flags only on tests
that have cone and plot in their name. Also, we would like to run this on
4 processors. We can run:
.. code-block:: sh
python run_tests.py -j 4 -C debug -R "cone|plot"
Note that standard regular expression syntax is used for selecting build
configurations and tests. To print out a list of build configurations, we
can run:
.. code-block:: sh
python run_tests.py -p
Adding tests to test suite
++++++++++++++++++++++++++
To add a new test to the test suite, create a sub-directory in the tests
directory that conforms to the regular expression *test_*. To configure
a test you need to add the following files to your new test directory,
*test_name* for example:
* OpenMC input XML files
* **test_name.py** - python test driver script, please refer to other
tests to see how to construct. Any output files that are generated
during testing must be removed at the end of this script.
* **results.py** - python script that extracts results from statepoint
output files. By default it should look for a binary file, but can
take an argument to overwrite which statepoint file is processed,
whether it is at a different batch or with an HDF5 extension. This
script must output a results file that is named *results_test.dat*.
It is recommended that any real numbers reported use *12.6E* format.
* **results_true.dat** - ASCII file that contains the expected results
from the test. The file *results_test.dat* is compared to this file
during the execution of the python test driver script. When the
above files have been created, generate a *results_test.dat* file and
copy it to this name and commit. It should be noted that this file
should be generated with basic compiler options during openmc
configuration and build (e.g., no MPI/HDF5, no debug/optimization).
In addition to this description, please see the various types of tests that
are already included in the test suite to see how to create them. If all is
implemented correctly, the new test directory will automatically be added
to the CTest framework.
Private Development
-------------------
@ -108,10 +183,10 @@ from your private repository into a public fork.
.. _git: http://git-scm.com/
.. _GitHub: https://github.com/
.. _git flow: http://nvie.com/git-model
.. _test_compile.py: https://github.com/mit-crpg/openmc/blob/develop/tests/test_compile/test_compile.py
.. _valgrind: http://valgrind.org/
.. _style guide: http://mit-crpg.github.io/openmc/devguide/styleguide.html
.. _pull request: https://help.github.com/articles/using-pull-requests
.. _mit-crpg/openmc: https://github.com/mit-crpg/openmc
.. _paid plan: https://github.com/plans
.. _Bitbucket: https://bitbucket.org
.. _ctest: http://www.cmake.org/cmake/help/v2.8.12/ctest.html

View file

@ -4,10 +4,6 @@
Release Notes for OpenMC 0.5.4
==============================
.. note::
These release notes are for an upcoming release of OpenMC and are still
subject to change.
-------------------
System Requirements
-------------------
@ -21,16 +17,17 @@ the problem at hand (mostly on the number of nuclides in the problem).
New Features
------------
- New XML parsing backend (FoX)
- Source sites outside geometry are resampled
- XML-Fortran backend replaced by FoX XML
- Ability to write particle track files
- Handle lost particles more gracefully (via particle track files)
- Source sites outside geometry are resampled
- Multiple random number generator streams
- plot_mesh_tally.py utility converted to use Tkinter rather than PyQt
- Mesh tally plotting utility converted to use Tkinter rather than PyQt
- Script added to download ACE data from NNDC
- Mixed ASCII/binary cross_sections.xml now allowed
- Expanded options for writing source bank
- Re-enabled ability to use source file as starting source
- S(a,b) recalculation avoided when same nuclide and S(a,b) table are accessed
---------
Bug Fixes
@ -41,12 +38,16 @@ Bug Fixes
- 8884fb_: Check for all ZAIDs for S(a,b) tables
- b38af0_: Fix XML reading on multiple levels of input
- d28750_: Fix bug in convert_xsdir.py
- cf567c_: ENDF/B-VI data checked for compatibility
- 6b9461_: Fix p_valid sampling inside of sample_energy
.. _32c03c: https://github.com/mit-crpg/openmc/commit/32c03c
.. _c71ef5: https://github.com/mit-crpg/openmc/commit/c71ef5
.. _8884fb: https://github.com/mit-crpg/openmc/commit/8884fb
.. _b38af0: https://github.com/mit-crpg/openmc/commit/b38af0
.. _d28750: https://github.com/mit-crpg/openmc/commit/d28750
.. _cf567c: https://github.com/mit-crpg/openmc/commit/cf567c
.. _6b9461: https://github.com/mit-crpg/openmc/commit/6b9461
------------
Contributors

View file

@ -414,6 +414,8 @@ attributes/sub-elements:
source bank will be available. It should be noted that a user can set both
this element to "true" and specify batches to write a permanent source bank.
*Default*: false
``<survival_biasing>`` Element
------------------------------

View file

@ -83,8 +83,8 @@ Prerequisites
OpenMC with. HDF5_ must be built with parallel I/O features if you intend
to use HDF5_ with MPI. An example of configuring HDF5_ is listed below::
FC=/opt/mpich/3.0.4-gnu/bin/mpif90 CC=/opt/mpich/3.0.4-gnu/bin/mpicc \
./configure --prefix=/opt/hdf5/1.8.11-gnu --enable-fortran \
FC=/opt/mpich/3.1/bin/mpif90 CC=/opt/mpich/3.1/bin/mpicc \
./configure --prefix=/opt/hdf5/1.8.12 --enable-fortran \
--enable-fortran2003 --enable-parallel
You may omit ``--enable-parallel`` if you want to compile HDF5_ in serial.
@ -97,8 +97,8 @@ Prerequisites
requires PETSc_ to be configured with Fortran datatypes. An example of
configuring PETSc_ is listed below::
./configure --prefix=/opt/petsc/3.4.2-gnu --download-f-blas-lapack \
--with-mpi-dir=/opt/mpich/3.0.4-gnu/ --with-shared-libraries=0 \
./configure --prefix=/opt/petsc/3.4.4 --download-f-blas-lapack \
--with-mpi-dir=/opt/mpich/3.1 --with-shared-libraries \
--with-fortran-datatypes
The BLAS/LAPACK library is not required to be downloaded and can be linked
@ -194,8 +194,8 @@ should be used:
Compiling with MPI
++++++++++++++++++
To compile with MPI, set the FC environment variable to the path to the MPI
Fortran wrapper. For example, in a bash shell:
To compile with MPI, set the :envvar:`FC` environment variable to the path to
the MPI Fortran wrapper. For example, in a bash shell:
.. code-block:: sh
@ -212,8 +212,8 @@ command, i.e.
Compiling with HDF5
+++++++++++++++++++
To compile with MPI, set the FC environment variable to the path to the HDF5
Fortran wrapper. For example, in a bash shell:
To compile with MPI, set the :envvar:`FC` environment variable to the path to
the HDF5 Fortran wrapper. For example, in a bash shell:
.. code-block:: sh
@ -322,6 +322,29 @@ This will build an executable named ``openmc``.
.. _MinGW: http://www.mingw.org
.. _SourceForge: http://sourceforge.net/projects/mingw
Testing Build
-------------
If you have ENDF/B-VII.0 cross sections from MCNP5/X you can test your build.
There are two ways to run tests. The first is to use the Makefile present in
the source directory and run the following:
.. code-block:: sh
cd src
make test
If you want more options for testing you can use ctest_ command. For example,
if we wanted to run only the plot tests with 4 processors, we run:
.. code-block:: sh
cd src/build
ctest -j 4 -R plot
If you want to run the full test suite with different build options please
refer to our :ref:`test suite` documentation.
---------------------------
Cross Section Configuration
---------------------------
@ -467,3 +490,4 @@ schemas.xml file in your own OpenMC source directory.
.. _GNU Emacs: http://www.gnu.org/software/emacs/
.. _validation: http://en.wikipedia.org/wiki/XML_validation
.. _RELAX NG: http://relaxng.org/
.. _ctest: http://www.cmake.org/cmake/help/v2.8.12/ctest.html

View file

@ -6,7 +6,9 @@ clean:
make -s -C build clean
distclean:
rm -fr build
test:
make -s -C build test
install:
make -s -C build install
.PHONY: all clean distclean install
.PHONY: all clean distclean test install

View file

@ -396,7 +396,7 @@ contains
end subroutine indices_to_matrix
!===============================================================================
! MATRIX_TO_INDICES converts a matrix index to spatial and group indicies
! MATRIX_TO_INDICES converts a matrix index to spatial and group indices
!===============================================================================
subroutine matrix_to_indices(irow, g, i, j, k, ng, nx, ny, nz)

View file

@ -8,7 +8,7 @@ module constants
! OpenMC major, minor, and release numbers
integer, parameter :: VERSION_MAJOR = 0
integer, parameter :: VERSION_MINOR = 5
integer, parameter :: VERSION_RELEASE = 3
integer, parameter :: VERSION_RELEASE = 4
! Revision numbers for binary files
integer, parameter :: REVISION_STATEPOINT = 11

View file

@ -359,7 +359,7 @@ module global
logical :: cmfd_tally_on = .true.
! CMFD display info
character(len=25) :: cmfd_display
character(len=25) :: cmfd_display = 'balance'
! Information about state points to be written
integer :: n_state_points = 0

View file

@ -685,7 +685,10 @@ contains
call get_node_value(node_sp, "overwrite_latest", temp_str)
call lower_case(temp_str)
if (trim(temp_str) == 'true' .or. &
trim(temp_str) == '1') source_latest = .true.
trim(temp_str) == '1') then
source_latest = .true.
source_separate = .true.
end if
end if
else
! If no <source_point> tag was present, by default we keep source bank in

View file

@ -867,9 +867,9 @@ contains
end if
! Bank source neutrons
if (nu == 0 .or. n_bank == 3*work) return
if (nu == 0 .or. n_bank == size(fission_bank)) return
p % fission = .true. ! Fission neutrons will be banked
do i = int(n_bank,4) + 1, int(min(n_bank + nu, 3*work),4)
do i = int(n_bank,4) + 1, int(min(n_bank + nu, int(size(fission_bank),8)),4)
! Bank source neutrons by copying particle data
fission_bank(i) % xyz = p % coord0 % xyz
@ -894,7 +894,7 @@ contains
end do
! increment number of bank sites
n_bank = min(n_bank + nu, 3*work)
n_bank = min(n_bank + nu, int(size(fission_bank),8))
! Store total weight banked for analog fission tallies
p % n_bank = nu
@ -1331,19 +1331,17 @@ contains
! SAMPLE ENERGY DISTRIBUTION IF THERE ARE MULTIPLE
if (associated(edist % next)) then
if (edist % p_valid % n_regions > 0) then
p_valid = interpolate_tab1(edist % p_valid, E_in)
p_valid = interpolate_tab1(edist % p_valid, E_in)
if (prn() > p_valid) then
if (edist % law == 44 .or. edist % law == 61) then
call sample_energy(edist%next, E_in, E_out, mu_out)
elseif (edist % law == 66) then
call sample_energy(edist%next, E_in, E_out, A=A, Q=Q)
else
call sample_energy(edist%next, E_in, E_out)
end if
return
if (prn() > p_valid) then
if (edist % law == 44 .or. edist % law == 61) then
call sample_energy(edist%next, E_in, E_out, mu_out)
elseif (edist % law == 66) then
call sample_energy(edist%next, E_in, E_out, A=A, Q=Q)
else
call sample_energy(edist%next, E_in, E_out)
end if
return
end if
end if

View file

@ -130,6 +130,7 @@ contains
end if
end if
end do
call p % clear()
case (SRC_SPACE_POINT)
! Point source

View file

@ -104,7 +104,7 @@ contains
! Write out CMFD info
if (cmfd_on) then
call sp % write_data(1, "cmfd_on")
call sp % write_data(cmfd % indices, "indicies", length=4, group="cmfd")
call sp % write_data(cmfd % indices, "indices", length=4, group="cmfd")
call sp % write_data(cmfd % k_cmfd, "k_cmfd", length=current_batch, &
group="cmfd")
call sp % write_data(cmfd % cmfd_src, "cmfd_src", &
@ -230,13 +230,13 @@ contains
end do TALLY_METADATA
end if
! Indicate where source bank is stored in statepoint
if (source_separate) then
call sp % write_data(0, "source_present")
else
call sp % write_data(1, "source_present")
end if
! Indicate where source bank is stored in statepoint
if (source_separate) then
call sp % write_data(0, "source_present")
else
call sp % write_data(1, "source_present")
end if
! Check for the no-tally-reduction method
@ -517,7 +517,6 @@ contains
subroutine load_state_point()
character(MAX_FILE_LEN) :: filename
character(MAX_FILE_LEN) :: path_temp
character(19) :: current_time
integer :: i
@ -599,7 +598,7 @@ contains
! Write out CMFD info
if (int_array(1) == 1) then
call sp % read_data(cmfd % indices, "indicies", length=4, group="cmfd")
call sp % read_data(cmfd % indices, "indices", length=4, group="cmfd")
call sp % read_data(cmfd % k_cmfd, "k_cmfd", length=restart_batch, &
group="cmfd")
length = cmfd % indices([4,1,2,3])
@ -790,7 +789,7 @@ contains
call sp % file_close()
! Write message
message = "Loading source file " // trim(filename) // "..."
message = "Loading source file " // trim(path_source_point) // "..."
call write_message(1)
! Open source file

View file

@ -195,7 +195,7 @@ class StatePoint(object):
# Read CMFD information
cmfd_present = self._get_int(path='cmfd_on')[0]
if cmfd_present == 1:
self.cmfd_indices = self._get_int(4, path='cmfd/indicies')
self.cmfd_indices = self._get_int(4, path='cmfd/indices')
self.k_cmfd = self._get_double(self.current_batch,
path='cmfd/k_cmfd')
self.cmfd_src = self._get_double_array(np.product(self.cmfd_indices),

View file

@ -4,29 +4,41 @@ OpenMC Test Suite
The purpose of this test suite is to ensure that OpenMC compiles using various
combinations of compiler flags and options and that all user input options can
be used successfully without breaking the code. The test suite is by no means
complete and should not be viewed as a comprehensive unit test suite will full
coverage. Until more effort can be put into actual unit testing, this suite is a
simple means of making sure that new features added into the code don't break
existing features.
be used successfully without breaking the code. The test suite is based on
regression or integrated testing where different types of input files are
configured and the full OpenMC code is executed. Results from simulations
are compared with expected results. The test suite is comprised of many
build configurations (e.g. debug, mpi, hdf5) and the actual tests which
reside in sub-directories in the tests directory.
The test suite is designed to run with the third-party Python package
nose_. Running the test suite is as simple as going to the tests/ directory and
running:
The test suite is designed to integrate with cmake using ctest_. To run the
full test suite run:
.. sh::
nosetests
.. code-block:: sh
However, usually testing is split into two parts: compilation and running. To
run the compilation tests, use:
python run_tests.py
.. sh::
nosetests test_compile
A subset of build configurations and/or tests can be run. To see how to use
the script run:
Then, to run all the normal tests (which require that an OpenMC executable is
already built):
.. code-block:: sh
.. sh::
nosetests --exclude-dir=test_compile
python run_tests.py --help
.. _nose: https://nose.readthedocs.org
As an example, say we want to run all tests with debug flags only on tests
that have cone and plot in their name. Also, we would like to run this on
4 processors. We can run:
.. code-block:: sh
python run_tests.py -j 4 -C debug -R "cone|plot"
Note that standard regular expression syntax is used for selecting build
configurations and tests. To print out a list of build configurations, we
can run:
.. code-block:: sh
python run_tests.py -p
.. _ctest: http://www.cmake.org/cmake/help/v2.8.12/ctest.html

View file

@ -3,10 +3,28 @@
from __future__ import print_function
import os
import sys
import shutil
import re
from subprocess import call
from collections import OrderedDict
from optparse import OptionParser
parser = OptionParser()
parser.add_option('-j', '--parallel', dest='n_procs',
help="Number of parallel jobs.")
parser.add_option('-R', '--tests-regex', dest='regex_tests',
help="Run tests matching regular expression. \
Test names are the directories present in tests folder.\
This uses standard regex syntax to select tests.")
parser.add_option('-C', '--build-config', dest='build_config',
help="Build configurations matching regular expression. \
Specific build configurations can be printed out with \
optional argument -p, --print. This uses standard \
regex syntax to select build configurations.")
parser.add_option('-p', '--print', action="store_true",
dest="print_build_configs", default=False,
help="Print out build configurations.")
(opts, args) = parser.parse_args()
# Compiler paths
FC_DEFAULT='gfortran'
@ -68,7 +86,17 @@ class Test(object):
def run_make(self):
if not self.success:
return
rc = call(['make','-j', '-s','-C','build'])
# Default make string
make_list = ['make','-s']
# Check for parallel
if opts.n_procs is not None:
make_list.append('-j')
make_list.append(opts.n_procs)
# Run make
rc = call(make_list)
if rc != 0:
self.success = False
self.msg = 'Failed on make.'
@ -76,7 +104,22 @@ class Test(object):
def run_ctests(self):
if not self.success:
return
rc = call(['make','test','-C','build'])
# Default ctest string
ctest_list = ['ctest']
# Check for parallel
if opts.n_procs is not None:
ctest_list.append('-j')
ctest_list.append(opts.n_procs)
# Check for subset of tests
if opts.regex_tests is not None:
ctest_list.append('-R')
ctest_list.append(opts.regex_tests)
# Run ctests
rc = call(ctest_list)
if rc != 0:
self.success = False
self.msg = 'Failed on testing.'
@ -117,67 +160,58 @@ add_test('phdf5-petsc-normal', mpi=True, hdf5=True, petsc=True)
add_test('phdf5-petsc-debug', mpi=True, hdf5=True, petsc=True, debug=True)
add_test('phdf5-petsc-optimize', mpi=True, hdf5=True, petsc=True, optimize=True)
add_test('omp-phdf5-petsc-normal', openmp=True, mpi=True, hdf5=True, petsc=True)
add_test('omp-phdf5-petsc-debug', openmp=True, mpi=True, hdf5=True, petsc=True, debug=True)
add_test('omp-phdf5-petsc-optimize', openmp=True, mpi=True, hdf5=True, petsc=True, optimize=True)
add_test('omp-phdf5-petsc-debug', openmp=True, mpi=True, hdf5=True, petsc=True,
debug=True)
add_test('omp-phdf5-petsc-optimize', openmp=True, mpi=True, hdf5=True, petsc=True,
optimize=True)
# Process command line arguments
if len(sys.argv) > 1:
flags = [i for i in sys.argv[1:] if i.startswith('-')]
tests_ = [i for i in sys.argv[1:] if not i.startswith('-')]
# Check to see if we are to just print build configuratinos
if opts.print_build_configs:
for key in tests:
print('Configuration Name: {0}'.format(key))
print(' Debug Flags:..........{0}'.format(tests[key].debug))
print(' Optimization Flags:...{0}'.format(tests[key].optimize))
print(' HDF5 Active:..........{0}'.format(tests[key].hdf5))
print(' MPI Active:...........{0}'.format(tests[key].mpi))
print(' OpenMP Active:........{0}'.format(tests[key].openmp))
print(' PETSc Active:.........{0}\n'.format(tests[key].petsc))
exit()
# Check for special subsets of tests
tests__ = []
for i in tests_:
# This checks for any subsets of tests. The string after
# all-XXXX will be used to search through all tests.
if i.startswith('all-'):
suffix = i.split('all-')[1]
for j in tests:
if j.rfind(suffix) != -1:
try:
tests__.index(j)
except ValueError:
tests__.append(j)
# Test name specified on command line
else:
try:
tests__.index(i)
except ValueError:
tests__.append(i) # append specific test (e.g., mpi-debug)
# Delete items of dictionary that are not in tests__
for key in iter(tests):
try:
tests__.index(key)
except ValueError:
# Delete items of dictionary that don't match regular expression
if opts.build_config is not None:
for key in tests:
if not re.search(opts.build_config, key):
del tests[key]
# Begin testing
call(['rm','-rf','build'])
for test in iter(tests):
shutil.rmtree('build', ignore_errors=True)
for test in tests:
print('-'*(len(test) + 6))
print(test + ' tests')
print('-'*(len(test) + 6))
# Run CMAKE to configure build
tests[test].run_cmake()
# Go into build directory
os.chdir('build')
# Build OpenMC
tests[test].run_make()
# Run tests
tests[test].run_ctests()
# Leave build directory
os.chdir('..')
# Copy test log file if failed
if tests[test].msg == 'Failed on testing.':
shutil.copy('build/Testing/Temporary/LastTest.log',
'LastTest_{0}.log'.format(test))
# Clean up build
call(['rm','-rf','build'])
shutil.rmtree('build', ignore_errors=True)
# Print out summary of results
print('\n' + '='*54)
@ -188,7 +222,7 @@ FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
for test in iter(tests):
for test in tests:
print(test + '.'*(50 - len(test)), end='')
if tests[test].success:
print(BOLD + OK + '[OK]' + ENDC)

View file

@ -47,7 +47,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -54,7 +54,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -55,7 +55,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -55,7 +55,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -51,7 +51,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -47,7 +47,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -47,7 +47,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -47,7 +47,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -47,7 +47,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -47,7 +47,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -47,7 +47,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -47,7 +47,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -48,7 +48,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -51,7 +51,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -48,7 +48,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -51,7 +51,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -51,7 +51,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -51,7 +51,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -51,7 +51,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -51,7 +51,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -51,7 +51,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -51,7 +51,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -51,7 +51,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -47,7 +47,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -47,7 +47,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -1,2 +1,2 @@
k-combined:
1.012443E+00 2.162448E-02
1.010190E+00 1.740589E-02

View file

@ -47,7 +47,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -59,7 +59,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -54,7 +54,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -33,7 +33,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -35,7 +35,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -33,7 +33,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -35,7 +35,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -47,7 +47,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -47,7 +47,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -47,7 +47,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -47,7 +47,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -47,7 +47,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -47,7 +47,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -47,7 +47,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -1,2 +1,2 @@
k-combined:
9.761880E-01 9.170415E-03
9.701793E-01 8.482149E-03

View file

@ -47,7 +47,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -51,7 +51,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -51,7 +51,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -51,7 +51,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -51,7 +51,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -51,7 +51,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -51,7 +51,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -51,7 +51,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -51,7 +51,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -51,7 +51,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -51,7 +51,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -51,7 +51,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -51,7 +51,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -51,7 +51,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -47,7 +47,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -47,7 +47,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -47,7 +47,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -47,7 +47,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -105,7 +105,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -47,7 +47,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -47,7 +47,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -47,7 +47,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<settings>
<source_point batches="0" separate="true" overwrite_latest="true"/>
<source_point batches="0" overwrite_latest="true"/>
<eigenvalue>
<batches>10</batches>

View file

@ -52,7 +52,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -129,7 +129,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -55,7 +55,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -64,7 +64,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -118,7 +118,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -52,7 +52,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -47,7 +47,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -51,7 +51,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -49,7 +49,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -61,7 +61,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -47,7 +47,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -47,7 +47,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -47,7 +47,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -1,2 +1,2 @@
k-combined:
1.010313E+00 3.162080E-02
1.006312E+00 3.000112E-02

View file

@ -47,7 +47,7 @@ def teardown():
if __name__ == '__main__':
# test for openmc executable
if opts.exe == None:
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests

View file

@ -1,30 +1,48 @@
#!/usr/bin/env python
from __future__ import print_function
import os
import sys
import re
from subprocess import Popen, call, STDOUT, PIPE
from glob import glob
from optparse import OptionParser
parser = OptionParser()
parser.add_option('--exe', dest='exe',
help="Path to openmc executable with basic \
configuration options (no HDF5, no MPI, etc.)")
parser.add_option('-R', '--tests-regex', dest='regex_tests',
help="Run tests matching regular expression. \
Test names are the directories present in tests folder.\
This uses standard regex syntax to select tests.")
(opts, args) = parser.parse_args()
cwd = os.getcwd()
# Terminal color configurations
OKGREEN = '\033[92m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
# Check for arguments
if len(sys.argv) > 1:
folders = []
for i in range(len(sys.argv)):
if i == 0:
continue
folders.append(sys.argv[i])
# Check for valid executable
if opts.exe is None:
raise Exception('Need to specify an OpenMC executable')
else:
folders = glob('test_*')
openmc_exe = os.path.abspath(opts.exe)
# Get a list of all test folders
folders = glob('test_*')
# Check to see if a subset of tests is specified on command line
if opts.regex_tests is not None:
folders = [item for item in folders if re.search(opts.regex_tests, item)]
# Loop around directories
for adir in sorted(folders):
# Skip test compile or plot
if adir == 'test_compile' or adir.find('plot') != -1:
if adir.find('plot') != -1:
continue
# Go into that directory
@ -33,18 +51,18 @@ for adir in sorted(folders):
os.putenv('PWD', pwd)
# Print status to screen
sys.stdout.write(adir)
print(adir, end="")
sz = len(adir)
for i in range(35 - sz):
sys.stdout.write('.')
print('.', end="")
# Run openmc
proc = Popen(['../../src/openmc'], stderr=STDOUT, stdout=PIPE)
proc = Popen([openmc_exe], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
if returncode == 0:
sys.stdout.write(BOLD + OKGREEN + "[OK]" + ENDC + "\n")
print(BOLD + OKGREEN + "[OK]" + ENDC)
else:
sys.stdout.write(BOLD + FAIL + "[FAILED]" + ENDC + "\n")
print(BOLD + FAIL + "[FAILED]" + ENDC)
# Process results
if returncode == 0: