ctest script executed from python script

This commit is contained in:
Bryan Herman 2014-03-06 14:30:51 -05:00
parent 7c34f5c109
commit 160569cced

View file

@ -66,10 +66,13 @@ class Test(object):
self.build_opts = build_str
return self.build_opts
def run_ctest(self, ctest_vars):
def create_ctest_script(self, ctest_vars):
with open('ctestscript.run', 'w') as fh:
fh.write(ctest_str.format(**ctest_vars))
def run_ctest(self):
call(['ctest', '-S', 'ctestscript.run','-V'])
def add_test(name, debug=False, optimize=False, mpi=False, openmp=False,\
hdf5=False, petsc=False, valgrind=False):
tests.update({name:Test(name, debug, optimize, mpi, openmp, hdf5, petsc, valgrind)})
@ -126,8 +129,11 @@ for key in iter(tests):
ctest_vars.update({'build_name' : test.get_build_name()})
ctest_vars.update({'build_opts' : test.get_build_opts()})
# Create ctest script
test.create_ctest_script(ctest_vars)
# Run test
test.run_ctest(ctest_vars)
test.run_ctest()
# Clear build directory
call(['rm', '-rf', 'build'])