From 6154c4db60eaae55ff835017eda76cde0fd4716d Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Tue, 10 Sep 2013 15:31:12 -0400 Subject: [PATCH] added more options for running test suite --- tests/run_tests.py | 53 +++++++++++++++++++++++++---- tests/test_compile/test_compile.py | 54 ++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+), 6 deletions(-) diff --git a/tests/run_tests.py b/tests/run_tests.py index 5e261fba73..e8650c52f4 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -67,22 +67,63 @@ sys.path.append(pwd) # Set list of tests, either default or from command line flags = [] -tests = ['compile', 'normal', 'debug', 'optimize', 'hdf5', 'mpi', 'phdf5', - 'petsc', 'phdf5-petsc', 'phdf5-petsc-optimize'] +tests = ['compile', 'normal', 'debug', 'optimize', + 'hdf5', 'hdf5-debug', 'hdf5-optimize', + 'mpi', 'mpi-debug', 'mpi-optimize', + 'phdf5', 'phdf5-debug', 'phdf5-optimize', + 'petsc', 'petsc-debug', 'petsc-optimize', + 'phdf5-petsc', 'phdf5-petsc-debug', '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 = tests_ if tests_ else tests + + # Check for special subsets of tests + tests__ = [] + for i in tests_: + + # All tests will run all the tests except for compile unless + # it is also specified on the command line. Note that specifying + # compile all-tests is the same as not specifying any args + if i == 'all-tests': + tests__ = tests + try: + idx = tests_.index('compile') # check for compile test + except ValueError: + del tests__[0] + finally: + break # don't need to check for anything else + + # This checks for any subsets of tests. The string after + # all-XXXX will be used to search through all tests. + # Specifying XXXX=normal will run tests that don't contain + # debug or optimize substring. + if i.startswith('all-'): + suffix = i.split('all-')[1] + if suffix == 'normal': + for j in tests: + if j.rfind('debug') == -1 and \ + j.rfind('optimize') == -1: + tests__.append(j) + else: + for j in tests: + if j.rfind(suffix) != -1: + tests__.append(j) + else: + tests__.append(i) # append specific test (e.g., mpi-debug) + tests = tests__ if tests__ else tests # Run tests results = [] for name in tests: if name == 'compile': run_compile() - elif name in ['normal', 'debug', 'optimize', 'hdf5']: + elif name in ['normal', 'debug', 'optimize', + 'hdf5', 'hdf5-debug', 'hdf5-optimize']: run_suite(name=name) - elif name in ['mpi', 'phdf5', 'petsc', 'phdf5-petsc', - 'phdf5-petsc-optimize']: + elif name in ['mpi', 'mpi-debug', 'mpi-optimize', + 'phdf5', 'phdf5-debug', 'phdf5-optimize', + 'petsc', 'petsc-debug', 'petsc-optimize', + 'phdf5-petsc', 'phdf5-petsc-debug', 'phdf5-petsc-optimize']: run_suite(name=name, mpi=True) # print out summary of results diff --git a/tests/test_compile/test_compile.py b/tests/test_compile/test_compile.py index 72e4dd6535..a4b3704a08 100644 --- a/tests/test_compile/test_compile.py +++ b/tests/test_compile/test_compile.py @@ -53,30 +53,84 @@ def test_mpi(): assert returncode == 0 shutil.move('openmc', 'openmc-mpi') +def test_mpi_debug(): + returncode = run(['make','distclean']) + returncode = run(['make', compiler, 'MPI=yes', 'DEBUG=yes']) + assert returncode == 0 + shutil.move('openmc', 'openmc-mpi-debug') + +def test_mpi_optimize(): + returncode = run(['make','distclean']) + returncode = run(['make', compiler, 'MPI=yes', 'OPTIMIZE=yes']) + assert returncode == 0 + shutil.move('openmc', 'openmc-mpi-optimize') + def test_hdf5(): returncode = run(['make','distclean']) returncode = run(['make', compiler, 'HDF5=yes']) assert returncode == 0 shutil.move('openmc', 'openmc-hdf5') +def test_hdf5_debug(): + returncode = run(['make','distclean']) + returncode = run(['make', compiler, 'HDF5=yes', 'DEBUG=yes']) + assert returncode == 0 + shutil.move('openmc', 'openmc-hdf5-debug') + +def test_hdf5_optimize(): + returncode = run(['make','distclean']) + returncode = run(['make', compiler, 'HDF5=yes', 'OPTIMIZE=yes']) + assert returncode == 0 + shutil.move('openmc', 'openmc-hdf5-optimize') + def test_petsc(): returncode = run(['make','distclean']) returncode = run(['make', compiler, 'MPI=yes', 'PETSC=yes']) assert returncode == 0 shutil.move('openmc', 'openmc-petsc') +def test_petsc_debug(): + returncode = run(['make','distclean']) + returncode = run(['make', compiler, 'MPI=yes', 'PETSC=yes', 'DEBUG=yes']) + assert returncode == 0 + shutil.move('openmc', 'openmc-petsc-debug') + +def test_petsc_optimize(): + returncode = run(['make','distclean']) + returncode = run(['make', compiler, 'MPI=yes', 'PETSC=yes', 'OPTIMIZE=yes']) + assert returncode == 0 + shutil.move('openmc', 'openmc-petsc-optimize') + def test_mpi_hdf5(): returncode = run(['make','distclean']) returncode = run(['make', compiler, 'MPI=yes', 'HDF5=yes']) assert returncode == 0 shutil.move('openmc', 'openmc-phdf5') +def test_mpi_hdf5_debug(): + returncode = run(['make','distclean']) + returncode = run(['make', compiler, 'MPI=yes', 'HDF5=yes', 'DEBUG=yes']) + assert returncode == 0 + shutil.move('openmc', 'openmc-phdf5-debug') + +def test_mpi_hdf5_optimize(): + returncode = run(['make','distclean']) + returncode = run(['make', compiler, 'MPI=yes', 'HDF5=yes', 'OPTIMIZE=yes']) + assert returncode == 0 + shutil.move('openmc', 'openmc-phdf5-optimize') + def test_mpi_hdf5_petsc(): returncode = run(['make','distclean']) returncode = run(['make', compiler, 'MPI=yes', 'HDF5=yes', 'PETSC=yes']) assert returncode == 0 shutil.move('openmc', 'openmc-phdf5-petsc') +def test_mpi_hdf5_petsc_debug(): + returncode = run(['make','distclean']) + returncode = run(['make', compiler, 'MPI=yes', 'HDF5=yes', 'PETSC=yes', 'DEBUG=yes']) + assert returncode == 0 + shutil.move('openmc', 'openmc-phdf5-petsc-debug') + def test_mpi_hdf5_petsc_optimize(): returncode = run(['make','distclean']) returncode = run(['make', compiler, 'MPI=yes', 'HDF5=yes', 'PETSC=yes', 'OPTIMIZE=yes'])