mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
updated run tests script to do work with test basic
This commit is contained in:
parent
8753d7b8b1
commit
f54b5fa2c7
3 changed files with 38 additions and 14 deletions
|
|
@ -4,14 +4,20 @@
|
|||
import os
|
||||
import sys
|
||||
import nose
|
||||
import glob
|
||||
from subprocess import call
|
||||
|
||||
pwd = os.getcwd()
|
||||
|
||||
# clean up all previous executables
|
||||
openmc_exe = glob.glob(pwd + '/../src/openmc*')
|
||||
for exe in openmc_exe:
|
||||
os.remove(exe)
|
||||
|
||||
# run compile test
|
||||
result = nose.run(argv=['run_tests.py','-v','test_compile'])
|
||||
if not result:
|
||||
sys.exit('Did not pass compile tests.')
|
||||
sys.stdout('Did not pass compile tests.')
|
||||
|
||||
# run gfortran tests
|
||||
print '\n--------------'
|
||||
|
|
@ -21,7 +27,7 @@ os.chdir(pwd)
|
|||
os.rename(pwd + '/../src/openmc-gfortran', pwd + '/../src/openmc')
|
||||
result = nose.run(argv=['run_tests.py','-v','--exclude','test_compile','test_basic'])
|
||||
if not result:
|
||||
sys.exit('Did not pass gfortran tests')
|
||||
sys.stdout('Did not pass gfortran tests')
|
||||
|
||||
# run gfortran-dbg tests
|
||||
print '\n--------------'
|
||||
|
|
@ -30,7 +36,7 @@ print '--------------\n'
|
|||
os.rename(pwd + '/../src/openmc-gfortran-dbg', pwd + '/../src/openmc')
|
||||
result = nose.run(argv=['run_tests.py','-v','--exclude','test_compile','test_basic'])
|
||||
if not result:
|
||||
sys.exit('Did not pass gfortran-dbg tests')
|
||||
sys.stdout('Did not pass gfortran-dbg tests')
|
||||
|
||||
# run gfortran-opt tests
|
||||
print '\n--------------'
|
||||
|
|
@ -39,7 +45,7 @@ print '--------------\n'
|
|||
os.rename(pwd + '/../src/openmc-gfortran-opt', pwd + '/../src/openmc')
|
||||
result = nose.run(argv=['run_tests.py','-v','--exclude','test_compile','test_basic'])
|
||||
if not result:
|
||||
sys.exit('Did not pass gfortran-opt tests')
|
||||
sys.stdout('Did not pass gfortran-opt tests')
|
||||
|
||||
# run gfortran-hdf5 tests
|
||||
print '\n--------------'
|
||||
|
|
@ -48,7 +54,7 @@ print '--------------\n'
|
|||
#os.rename(pwd + '/../src/openmc-gfortran-hdf5', pwd + '/../src/openmc')
|
||||
#result = nose.run(argv=['run_tests.py','-v','--exclude','test_compile','test_basic'])
|
||||
#if not result:
|
||||
# sys.exit('Did not pass gfortran-hdf5 tests')
|
||||
# sys.stdout('Did not pass gfortran-hdf5 tests')
|
||||
|
||||
# run gfortran-mpi tests
|
||||
print '\n--------------'
|
||||
|
|
@ -59,7 +65,7 @@ result = nose.run(argv=['run_tests.py','-v','--exclude','test_compile',
|
|||
'--mpi-np','3','--mpi-exec',
|
||||
'/opt/mpich/3.0.4-gnu/bin/mpiexec','test_basic'])
|
||||
if not result:
|
||||
sys.exit('Did not pass gfortran-mpi tests')
|
||||
sys.stdout('Did not pass gfortran-mpi tests')
|
||||
|
||||
# run gfortran-phdf5 tests
|
||||
print '\n--------------'
|
||||
|
|
@ -69,7 +75,7 @@ print '--------------\n'
|
|||
# '--mpi-np','3','--mpi-exec',
|
||||
# '/opt/mpich/3.0.4-gnu/bin/mpiexec','test_basic'])
|
||||
#if not result:
|
||||
# sys.exit('Did not pass gfortran-phdf5 tests')
|
||||
# sys.stdout('Did not pass gfortran-phdf5 tests')
|
||||
|
||||
# run gfortran-petsc tests
|
||||
print '\n--------------'
|
||||
|
|
@ -80,7 +86,7 @@ result = nose.run(argv=['run_tests.py','-v','--exclude','test_compile',
|
|||
'--mpi-np','3','--mpi-exec',
|
||||
'/opt/mpich/3.0.4-gnu/bin/mpiexec','test_basic'])
|
||||
if not result:
|
||||
sys.exit('Did not pass gfortran-petsc tests')
|
||||
sys.stdout('Did not pass gfortran-petsc tests')
|
||||
|
||||
# run gfortran-phdf5-petsc tests
|
||||
print '\n--------------'
|
||||
|
|
@ -91,4 +97,15 @@ result = nose.run(argv=['run_tests.py','-v','--exclude','test_compile',
|
|||
'--mpi-np','3','--mpi-exec',
|
||||
'/opt/mpich/3.0.4-gnu/bin/mpiexec','test_basic'])
|
||||
if not result:
|
||||
sys.exit('Did not pass gfortran-phdf5-petsc tests')
|
||||
sys.stdout('Did not pass gfortran-phdf5-petsc tests')
|
||||
|
||||
# run gfortran-phdf5-petsc-opt tests
|
||||
print '\n--------------'
|
||||
print 'gfortran-phdf5-petsc-opt tests'
|
||||
print '--------------\n'
|
||||
os.rename(pwd + '/../src/openmc-gfortran-phdf5-petsc-opt', pwd + '/../src/openmc')
|
||||
result = nose.run(argv=['run_tests.py','-v','--exclude','test_compile',
|
||||
'--mpi-np','3','--mpi-exec',
|
||||
'/opt/mpich/3.0.4-gnu/bin/mpiexec','test_basic'])
|
||||
if not result:
|
||||
sys.stdout('Did not pass gfortran-phdf5-petsc-opt tests')
|
||||
|
|
|
|||
|
|
@ -7,7 +7,10 @@ sys.path.append('../../src/utils')
|
|||
import statepoint
|
||||
|
||||
# read in statepoint file
|
||||
sp = statepoint.StatePoint('statepoint.10.binary')
|
||||
if len(sys.argv) > 1:
|
||||
sp = statepoint.StatePoint(sys.argv[1])
|
||||
else:
|
||||
sp = statepoint.StatePoint('statepoint.10.binary')
|
||||
sp.read_results()
|
||||
|
||||
# set up output string
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import os
|
|||
from subprocess import Popen, STDOUT, PIPE
|
||||
import filecmp
|
||||
from nose_mpi import NoseMPI
|
||||
import glob
|
||||
|
||||
pwd = os.path.dirname(__file__)
|
||||
|
||||
|
|
@ -12,7 +13,6 @@ def setup():
|
|||
os.chdir(pwd)
|
||||
|
||||
def test_run():
|
||||
|
||||
openmc_path = pwd + '/../../src/openmc'
|
||||
if int(NoseMPI.mpi_np) > 0:
|
||||
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
|
||||
|
|
@ -24,17 +24,21 @@ def test_run():
|
|||
assert returncode == 0
|
||||
|
||||
def test_created_statepoint():
|
||||
assert os.path.exists(pwd + '/statepoint.10.binary')
|
||||
statepoint = glob.glob('statepoint.10.*')
|
||||
assert len(statepoint) == 1
|
||||
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
|
||||
|
||||
def test_results():
|
||||
os.system('python results.py')
|
||||
statepoint = glob.glob('statepoint.10.*')
|
||||
os.system('python results.py {0}'.format(statepoint[0]))
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
os.rename('results_test.dat', 'results_error.dat')
|
||||
assert compare
|
||||
|
||||
def teardown():
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
|
||||
statepoint = glob.glob('statepoint.10.*')
|
||||
output = [pwd + '/{0}'.format(statepoint[0]), pwd + '/results_test.dat']
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue