Allow test suite to be run with compiler other than gfortran.

This commit is contained in:
Paul Romano 2013-09-07 15:02:46 -04:00
parent 5176369c00
commit 975fd21284
2 changed files with 47 additions and 39 deletions

View file

@ -55,7 +55,11 @@ def run_suite(name=None, mpi=False):
results.append((name, result))
# set mpiexec path
mpiexec = '/opt/mpich/3.0.4-gnu/bin/mpiexec'
if os.environ.has_key('COMPILER'):
compiler = os.environ['COMPILER']
else:
compiler = 'gnu'
mpiexec = '/opt/mpich/3.0.4-{0}/bin/mpiexec'.format(compiler)
# get current working directory
pwd = os.getcwd()
@ -63,23 +67,22 @@ sys.path.append(pwd)
# Set list of tests, either default or from command line
flags = []
tests = ['compile', 'gfortran', 'gfortran-dbg', 'gfortran-opt',
'gfortran-hdf5', 'gfortran-mpi', 'gfortran-phdf5',
'gfortran-petsc', 'gfortran-phdf5-petsc',
'gfortran-phdf5-petsc-opt']
tests = ['compile', 'normal', 'debug', 'optimize', 'hdf5', 'mpi', 'phdf5',
'petsc', 'phdf5-petsc', 'phdf5-petsc-optimize']
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('-')]
tests_ = [i for i in sys.argv[1:] if not i.startswith('-')]
tests = tests_ if tests_ else tests
# Run tests
results = []
for name in tests:
if name == 'compile':
run_compile()
elif name in ['gfortran', 'gfortran-dbg', 'gfortran-opt', 'gfortran-hdf5']:
elif name in ['normal', 'debug', 'optimize', 'hdf5']:
run_suite(name=name)
elif name in ['gfortran-mpi', 'gfortran-phdf5', 'gfortran-petsc',
'gfortran-phdf5-petsc', 'gfortran-phdf5-petsc-opt']:
elif name in ['mpi', 'phdf5', 'petsc', 'phdf5-petsc',
'phdf5-petsc-optimize']:
run_suite(name=name, mpi=True)
# print out summary of results

View file

@ -15,68 +15,73 @@ import shutil
pwd = os.path.dirname(__file__)
if os.environ.has_key('COMPILER'):
compiler = 'COMPILER=' + os.environ['COMPILER']
else:
compiler = 'COMPILER=gnu'
def setup():
# Change to source directory
os.chdir(pwd + '/../../src')
def test_gfortran():
def test_normal():
returncode = run(['make','distclean'])
returncode = run(['make'])
returncode = run(['make', compiler])
assert returncode == 0
shutil.move('openmc', 'openmc-gfortran')
shutil.move('openmc', 'openmc-normal')
def test_gfortran_debug():
def test_debug():
returncode = run(['make','distclean'])
returncode = run(['make', 'DEBUG=yes'])
returncode = run(['make', compiler, 'DEBUG=yes'])
assert returncode == 0
shutil.move('openmc', 'openmc-gfortran-dbg')
shutil.move('openmc', 'openmc-debug')
def test_gfortran_profile():
def test_profile():
returncode = run(['make','distclean'])
returncode = run(['make', 'PROFILE=yes'])
returncode = run(['make', compiler, 'PROFILE=yes'])
assert returncode == 0
def test_gfortran_optimize():
def test_optimize():
returncode = run(['make','distclean'])
returncode = run(['make', 'OPTIMIZE=yes'])
returncode = run(['make', compiler, 'OPTIMIZE=yes'])
assert returncode == 0
shutil.move('openmc', 'openmc-gfortran-opt')
shutil.move('openmc', 'openmc-optimize')
def test_gfortran_mpi():
def test_mpi():
returncode = run(['make','distclean'])
returncode = run(['make', 'MPI=yes'])
returncode = run(['make', compiler, 'MPI=yes'])
assert returncode == 0
shutil.move('openmc', 'openmc-gfortran-mpi')
shutil.move('openmc', 'openmc-mpi')
def test_gfortran_hdf5():
def test_hdf5():
returncode = run(['make','distclean'])
returncode = run(['make', 'HDF5=yes'])
returncode = run(['make', compiler, 'HDF5=yes'])
assert returncode == 0
shutil.move('openmc', 'openmc-gfortran-hdf5')
shutil.move('openmc', 'openmc-hdf5')
def test_gfortran_petsc():
def test_petsc():
returncode = run(['make','distclean'])
returncode = run(['make', 'MPI=yes', 'PETSC=yes'])
returncode = run(['make', compiler, 'MPI=yes', 'PETSC=yes'])
assert returncode == 0
shutil.move('openmc', 'openmc-gfortran-petsc')
shutil.move('openmc', 'openmc-petsc')
def test_gfortran_mpi_hdf5():
def test_mpi_hdf5():
returncode = run(['make','distclean'])
returncode = run(['make', 'MPI=yes', 'HDF5=yes'])
returncode = run(['make', compiler, 'MPI=yes', 'HDF5=yes'])
assert returncode == 0
shutil.move('openmc', 'openmc-gfortran-phdf5')
shutil.move('openmc', 'openmc-phdf5')
def test_gfortran_mpi_hdf5_petsc():
def test_mpi_hdf5_petsc():
returncode = run(['make','distclean'])
returncode = run(['make', 'MPI=yes', 'HDF5=yes', 'PETSC=yes'])
returncode = run(['make', compiler, 'MPI=yes', 'HDF5=yes', 'PETSC=yes'])
assert returncode == 0
shutil.move('openmc', 'openmc-gfortran-phdf5-petsc')
shutil.move('openmc', 'openmc-phdf5-petsc')
def test_gfortran_mpi_hdf5_petsc_optimize():
def test_mpi_hdf5_petsc_optimize():
returncode = run(['make','distclean'])
returncode = run(['make', 'MPI=yes', 'HDF5=yes', 'PETSC=yes', 'OPTIMIZE=yes'])
returncode = run(['make', compiler, 'MPI=yes', 'HDF5=yes', 'PETSC=yes', 'OPTIMIZE=yes'])
assert returncode == 0
shutil.move('openmc', 'openmc-gfortran-phdf5-petsc-opt')
shutil.move('openmc', 'openmc-phdf5-petsc-optimize')
def run(commands):
proc = Popen(commands, stderr=STDOUT, stdout=PIPE)
@ -86,4 +91,4 @@ def run(commands):
def teardown(commands):
returncode = run(['make','distclean'])
shutil.copy('openmc-gfortran','openmc')
shutil.copy('openmc-normal','openmc')