|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# Before running this script ######################################################## |
| 4 | + |
| 5 | +# Make sure you're on the branch you want to test! |
| 6 | + |
| 7 | +# If you want to test `main`, do the following: |
| 8 | +# git fetch upstream main |
| 9 | +# git checkout -b test_pre_zppy_rc<#>_<machine_name> upstream/main |
| 10 | +# git log # check the commits match https://github.com/E3SM-Project/zppy/commits/main |
| 11 | + |
| 12 | +# Set these parameters |
| 13 | +DIAGS_DIR=/home/ac.forsyth2/e3sm_diags/ |
| 14 | +DIAGS_DEV=diags_dev_2023_10_05 |
| 15 | +ZPPY_DIR=/home/ac.forsyth2/zppy/ |
| 16 | +DIAGS_ENV_CMD="source /home/ac.forsyth2/miniconda3/etc/profile.d/conda.sh; conda activate ${DIAGS_DEV}" |
| 17 | +ZPPY_DEV=zppy_dev_n516 |
| 18 | + |
| 19 | +# Make sure you do not have important changes on the `main` branch in your |
| 20 | +# E3SM_DIAGS_DIRECTORY. This script will reset that branch to match `upstream`! |
| 21 | + |
| 22 | +##################################################################################### |
| 23 | + |
| 24 | +echo "Update E3SM Diags" |
| 25 | +# `cd` to e3sm_diags directory |
| 26 | +cd ${DIAGS_DIR} |
| 27 | +git checkout main |
| 28 | +git fetch upstream |
| 29 | +git reset --hard upstream/main |
| 30 | +git log # Should match https://github.com/E3SM-Project/e3sm_diags/commits/main # TODO: Requires user review |
| 31 | +mamba clean --all # TODO: Requires user input to advance |
| 32 | +conda remove -n ${DIAGS_DEV} --all |
| 33 | +mamba env create -f conda-env/dev.yml -n ${DIAGS_DEV} |
| 34 | +conda activate ${DIAGS_DEV} # TODO: errors with ./tests/scripts/test_dev.bash: line 34: {DIAGS_DEV}: command not found |
| 35 | +pip install . |
| 36 | +cd ${ZPPY_DIR} |
| 37 | + |
| 38 | +echo "Make sure we're using the latest packages" |
| 39 | +UNIFIED_TESTING=False |
| 40 | +python tests/integration/utils.py ${UNIFIED_TESTING} ${DIAGS_ENV_CMD} |
| 41 | + |
| 42 | +echo "Set up our environment" |
| 43 | +mamba clean --all # TODO: Requires user input to advance |
| 44 | +mamba env create -f conda/dev.yml -n ${ZPPY_DEV} |
| 45 | +conda activate ${ZPPY_DEV} # TODO: errors with CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'. |
| 46 | +pip install . |
| 47 | + |
| 48 | +echo "Run unit tests" |
| 49 | +python -u -m unittest tests/test_*.py |
| 50 | +if [ $? != 0 ]; then |
| 51 | + echo 'ERROR (1): unit tests failed' |
| 52 | + exit 1 |
| 53 | +fi |
| 54 | + |
| 55 | +exit 7 |
| 56 | + |
| 57 | +echo "Set up integration tests" |
| 58 | +# TODO: somehow use Mache (a Python package) to get machine-independent paths in this bash script! |
| 59 | +# test_complete_run |
| 60 | +rm -rf /lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_test_complete_run_www/v2.LR.historical_0201 |
| 61 | +rm -rf /lcrc/group/e3sm/ac.forsyth2/zppy_test_complete_run_output/v2.LR.historical_0201/post |
| 62 | +# Run jobs: |
| 63 | +zppy -c tests/integration/generated/test_complete_run_chrysalis.cfg |
| 64 | +# TODO: how can we possibly tell, automatically, when this is finished? |
| 65 | +# After they finish, check the results: |
| 66 | +cd /lcrc/group/e3sm/ac.forsyth2/zppy_test_complete_run_output/v2.LR.historical_0201/post/scripts |
| 67 | +grep -v "OK" *status |
| 68 | +if [ $? == 0 ]; then |
| 69 | + # The above command succeeds only if there are reported failures. |
| 70 | + echo 'ERROR (2): zppy complete run failed.' |
| 71 | + exit 2 |
| 72 | +fi |
| 73 | +cd ${ZPPY_DIR} |
| 74 | +# test_bundles |
| 75 | +rm -rf /lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_test_bundles_www/v2.LR.historical_0201 |
| 76 | +rm -rf /lcrc/group/e3sm/ac.forsyth2/zppy_test_bundles_output/v2.LR.historical_0201/post |
| 77 | +# Run first set of jobs: |
| 78 | +zppy -c tests/integration/generated/test_bundles_chrysalis.cfg |
| 79 | +# TODO: how can we possibly tell, automatically, when this is finished? |
| 80 | +# bundle1 and bundle2 should run. After they finish, check the results: |
| 81 | +cd /lcrc/group/e3sm/ac.forsyth2/zppy_test_bundles_output/v2.LR.historical_0201/post/scripts |
| 82 | +grep -v "OK" *status |
| 83 | +if [ $? == 0 ]; then |
| 84 | + # The above command succeeds only if there are reported failures. |
| 85 | + echo 'ERROR (3): zppy bundles 1st run failed.' |
| 86 | + exit 3 |
| 87 | +fi |
| 88 | +cd ${ZPPY_DIR} |
| 89 | +# Now, invoke zppy again to run jobs that needed to wait for dependencies: |
| 90 | +zppy -c tests/integration/generated/test_bundles_chrysalis.cfg |
| 91 | +# TODO: how can we possibly tell, automatically, when this is finished? |
| 92 | +# bundle3 and ilamb should run. After they finish, check the results: |
| 93 | +cd /lcrc/group/e3sm/ac.forsyth2/zppy_test_bundles_output/v2.LR.historical_0201/post/scripts |
| 94 | +grep -v "OK" *status |
| 95 | +if [ $? == 0 ]; then |
| 96 | + # The above command succeeds only if there are reported failures. |
| 97 | + echo 'ERROR (4): zppy bundles 2nd run failed.' |
| 98 | + exit 4 |
| 99 | +fi |
| 100 | +cd ${ZPPY_DIR} |
| 101 | + |
| 102 | +echo "Run the integration tests" |
| 103 | +python -u -m unittest tests/integration/test_*.py |
| 104 | +if [ $? != 0 ]; then |
| 105 | + echo 'ERROR (5): integration tests failed' |
| 106 | + exit 5 |
| 107 | +fi |
| 108 | + |
| 109 | +echo "All tests passed!" |
0 commit comments