diff options
author | 2020-02-24 14:42:41 -0800 | |
---|---|---|
committer | 2020-02-24 14:42:41 -0800 | |
commit | 8c3523a1054a0d7591cac951aa723f2b01c8e68d (patch) | |
tree | 19fef83fb706b5161f98a6de3cdfdbd5069f31a1 /Regression/prepare_file_travis.py | |
parent | 7ed7f58a768dbeb72ca1bc269657af8b7b2e19b0 (diff) | |
download | WarpX-8c3523a1054a0d7591cac951aa723f2b01c8e68d.tar.gz WarpX-8c3523a1054a0d7591cac951aa723f2b01c8e68d.tar.zst WarpX-8c3523a1054a0d7591cac951aa723f2b01c8e68d.zip |
Split travis tests in bigger matrix (#723)
* split travis tests in bigger matrix
* split more TravisCI tests, add electrostatic, use defaults values
* typo
* need to split psatd too
* consistent variable names and use function to avoid duplication
* fix typo for qed tests
* typo
* also need to update run_tests.sg
* change matrix
* try gathering 2D and 3D tests together
* split test matrix to have 2 compilations for each group
* EOL
* avoid compiling electrostatic
* typo
* [ci skip] Update Regression/prepare_file_travis.py
Co-Authored-By: Axel Huebl <axel.huebl@plasma.ninja>
* this is an OR, not an AND
* test that TravisCI matrix encompasses all tests
* debugging
* debugging
* should fix the error
* Apply suggestions from code review
Co-Authored-By: Axel Huebl <axel.huebl@plasma.ninja>
* use fewer &&
* safeguard
* should work like that
Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
Diffstat (limited to 'Regression/prepare_file_travis.py')
-rw-r--r-- | Regression/prepare_file_travis.py | 65 |
1 files changed, 45 insertions, 20 deletions
diff --git a/Regression/prepare_file_travis.py b/Regression/prepare_file_travis.py index abec6baea..dfaacc77a 100644 --- a/Regression/prepare_file_travis.py +++ b/Regression/prepare_file_travis.py @@ -13,10 +13,15 @@ import re import os # Get relevant environment variables -dim = os.environ.get('WARPX_TEST_DIM', None) -qed = os.environ.get('HAS_QED', None) arch = os.environ.get('WARPX_TEST_ARCH', 'CPU') +ci_regular_cartesian = os.environ.get('WARPX_CI_REGULAR_CARTESIAN') == 'TRUE' +ci_psatd = os.environ.get('WARPX_CI_PSATD') == 'TRUE' +ci_python_main = os.environ.get('WARPX_CI_PYTHON_MAIN') == 'TRUE' +ci_single_precision = os.environ.get('WARPX_CI_SINGLE_PRECISION') == 'TRUE' +ci_rz_or_nompi = os.environ.get('WARPX_CI_RZ_OR_NOMPI') == 'TRUE' +ci_qed = os.environ.get('WARPX_CI_QED') == 'TRUE' + # Find the directory in which the tests should be run current_dir = os.getcwd() test_dir = re.sub('warpx/Regression', '', current_dir ) @@ -68,25 +73,45 @@ test_blocks = [ match[0] for match in re.findall(select_test_regex, text) ] # - Remove the test blocks from `text` (only the selected ones will be added back) text = re.sub( select_test_regex, '', text ) -# Keep tests that have the right dimension -if dim is not None: - print('Selecting tests with dim = %s' %dim) - # Cartesian tests - if dim in ['2', '3']: - test_blocks = [ block for block in test_blocks \ - if ('dim = %s'%dim in block) and not ('USE_RZ' in block) ] - elif dim == 'RZ': - test_blocks = [ block for block in test_blocks if 'USE_RZ' in block ] - else: - raise ValueError('Unkown dimension: %s' %dim) - -# Remove or keep QED tests according to 'qed' variable -if qed is not None: - print('Selecting tests with QED = %s' %qed) - if (qed == "FALSE"): - test_blocks = [ block for block in test_blocks if not 'QED=TRUE' in block ] +def select_tests(blocks, match_string_list, do_test): + """Remove or keep tests from list in WarpX-tests.ini according to do_test variable""" + if do_test not in [True, False]: + raise ValueError("do_test must be True or False") + if (do_test == False): + for match_string in match_string_list: + print('Selecting tests without ' + match_string) + blocks = [ block for block in blocks if not match_string in block ] else: - test_blocks = [ block for block in test_blocks if 'QED=TRUE' in block ] + for match_string in match_string_list: + print('Selecting tests with ' + match_string) + blocks = [ block for block in blocks if match_string in block ] + return blocks + +if ci_regular_cartesian: + test_blocks = select_tests(test_blocks, ['USE_RZ=TRUE'], False) + test_blocks = select_tests(test_blocks, ['USE_PSATD=TRUE'], False) + test_blocks = select_tests(test_blocks, ['PYTHON_MAIN=TRUE'], False) + test_blocks = select_tests(test_blocks, ['PRECISION=FLOAT', 'USE_SINGLE_PRECISION_PARTICLES=TRUE'], False) + test_blocks = select_tests(test_blocks, ['useMPI = 0'], False) + test_blocks = select_tests(test_blocks, ['QED=TRUE'], False) + +if ci_psatd: + test_blocks = select_tests(test_blocks, ['USE_PSATD=TRUE'], True) + +if ci_python_main: + test_blocks = select_tests(test_blocks, ['PYTHON_MAIN=TRUE'], True) + +if ci_single_precision: + test_blocks = select_tests(test_blocks, ['PRECISION=FLOAT', 'USE_SINGLE_PRECISION_PARTICLES=TRUE'], True) + +if ci_rz_or_nompi: + test_blocks = select_tests(test_blocks, ['PYTHON_MAIN=TRUE'], False) + block1 = select_tests(test_blocks, ['USE_RZ=TRUE'], True) + block2 = select_tests(test_blocks, ['useMPI = 0'], True) + test_blocks = block1 + block2 + +if ci_qed: + test_blocks = select_tests(test_blocks, ['QED=TRUE'], True) # - Add the selected test blocks to the text text = text + '\n' + '\n'.join(test_blocks) |