Merge branch 'ctests' into cdash

This commit is contained in:
Bryan Herman 2014-04-08 14:31:48 -04:00
commit 589b6f0eaf
2 changed files with 87 additions and 14 deletions

View file

@ -97,16 +97,59 @@ 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.
combinations of compiler flags and options, and that all user input options can
be used successfully without breaking the code. The test suite is comprised of
regression tests 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. We recommend to developers to test their branches
before submitting a formal pull request using gfortran and intel compilers
if available.
The test suite is designed to integrate with cmake using ctest_. To run the
full test suite run:
The test suite is designed to integrate with cmake using ctest_.
The test suite can be run on an already existing build using:
.. code-block:: sh
cd build
make test
or
.. code-block:: sh
cd build
ctest
There are numerous ctest_ command line options that can be set to have
more control over which tests are executed.
Before running the test suite python script, the following environmental
variables should be set if the default paths are incorrect:
* **FC** - The command of the Fortran compiler (e.g. gfotran, ifort).
* Default - *gfortran*
* **MPI_DIR** - The path to the MPI directory.
* Default - */opt/mpich/3.1-gnu*
* **HDF5_DIR** - The path to the HDF5 directory.
* Default - */opt/hdf5/1.8.12-gnu*
* **PHDF5_DIR** - The path to the parallel HDF5 directory.
* Default - */opt/phdf5/1.8.12-gnu*
* **PETSC_DIR** - The path to the PETSc directory.
* Default - */opt/petsc/3.4.4-gnu*
To run the full test suite, the following command can be executed in the
tests directory:
.. code-block:: sh

View file

@ -26,12 +26,26 @@ parser.add_option('-p', '--print', action="store_true",
help="Print out build configurations.")
(opts, args) = parser.parse_args()
# Compiler paths
FC_DEFAULT='gfortran'
MPI_DIR='/opt/mpich/3.0.4-gnu'
# Default compiler paths
FC='gfortran'
MPI_DIR='/opt/mpich/3.1-gnu'
HDF5_DIR='/opt/hdf5/1.8.12-gnu'
PHDF5_DIR='/opt/phdf5/1.8.12-gnu'
PETSC_DIR='/opt/petsc/3.4.3-gnu'
PETSC_DIR='/opt/petsc/3.4.4-gnu'
# Override default compiler paths if environmental vars are found
if os.environ.has_key('FC'):
FC = os.environ['FC']
if FC is not 'gfortran':
print('NOTE: Test suite only verifed for gfortran compiler.')
if os.environ.has_key('MPI_DIR'):
MPI_DIR = os.environ['MPI_DIR']
if os.environ.has_key('HDF5_DIR'):
HDF5_DIR = os.environ['HDF5_DIR']
if os.environ.has_key('PHDF5_DIR'):
PHDF5_DIR = os.environ['PHDF5_DIR']
if os.environ.has_key('PETSC_DIR'):
PETSC_DIR = os.environ['PETSC_DIR']
# Define test data structure
tests = OrderedDict()
@ -61,7 +75,7 @@ class Test(object):
elif self.mpi and self.hdf5:
self.fc = PHDF5_DIR+'/bin/h5pfc'
else:
self.fc = FC_DEFAULT
self.fc = FC
# Set rest of options
if self.debug:
@ -124,6 +138,19 @@ class Test(object):
self.success = False
self.msg = 'Failed on testing.'
# Checks to see if file exists in PWD or PATH
def check_compiler(self):
result = False
if os.path.isfile(self.fc):
result = True
for path in os.environ["PATH"].split(":"):
if os.path.isfile(path + "/" + self.fc):
result = True
if not result:
raise Exception("Compiler path '{0}' does not exist."
.format(self.fc)+
"Please set appropriate environmental variable(s).")
def add_test(name, debug=False, optimize=False, mpi=False, openmp=False,\
hdf5=False, petsc=False):
tests.update({name:Test(debug, optimize, mpi, openmp, hdf5, petsc)})
@ -190,6 +217,9 @@ for test in tests:
print(test + ' tests')
print('-'*(len(test) + 6))
# Verify fortran compiler exists
tests[test].check_compiler()
# Run CMAKE to configure build
tests[test].run_cmake()