|
2 | 2 |
|
3 | 3 | # Before running this script ######################################################## |
4 | 4 |
|
5 | | -# Make sure you're on the branch you want to test! |
6 | | - |
| 5 | +# Set up branch |
7 | 6 | # If you want to test `main`, do the following: |
8 | 7 | # git fetch upstream main |
9 | | -# git checkout -b test_pre_zppy_rc<#>_<machine_name> upstream/main |
| 8 | +# git checkout -b test_main_<date> upstream/main |
10 | 9 | # git log # check the commits match https://github.com/E3SM-Project/zppy/commits/main |
11 | 10 |
|
12 | | -# Set these parameters |
13 | | -DIAGS_DIR=/home/ac.forsyth2/e3sm_diags/ |
14 | | -DIAGS_DEV=diags_dev_2023_10_05 |
| 11 | +# Set these parameters: |
| 12 | + |
| 13 | +# Make sure you do not have important changes in any of these directories. This script will reset them! |
15 | 14 | ZPPY_DIR=/home/ac.forsyth2/zppy/ |
16 | | -DIAGS_ENV_CMD="source /home/ac.forsyth2/miniconda3/etc/profile.d/conda.sh; conda activate ${DIAGS_DEV}" |
| 15 | +DIAGS_DIR=/home/ac.forsyth2/e3sm_diags/ |
| 16 | +ZI_DIR=/home/ac.forsyth2/zppy-interfaces/ |
| 17 | + |
17 | 18 | ZPPY_DEV=zppy_dev_n516 |
| 19 | +DIAGS_DEV=diags_dev_2024_12_13 |
| 20 | +ZI_DEV=zi_dev_2024_12_13 |
18 | 21 |
|
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`! |
| 22 | +DIAGS_ENV_CMD="source /home/ac.forsyth2/miniconda3/etc/profile.d/conda.sh; conda activate ${DIAGS_DEV}" |
| 23 | +ZI_ENV_CMD="source /home/ac.forsyth2/miniconda3/etc/profile.d/conda.sh; conda activate ${ZI_DEV}" |
| 24 | + |
| 25 | +UNIQUE_ID="unique_id" |
21 | 26 |
|
22 | 27 | ##################################################################################### |
23 | 28 |
|
24 | | -echo "Update E3SM Diags" |
25 | | -# `cd` to e3sm_diags directory |
| 29 | +# Set up zppy-interfaces env |
| 30 | +cd ${ZI_DIR} |
| 31 | +git fetch upstream main |
| 32 | +git checkout main upstream/main |
| 33 | +if [ $? != 0 ]; then |
| 34 | + echo 'ERROR (1): Could not check out zppy-interfaces main branch' |
| 35 | + exit 1 |
| 36 | +fi |
| 37 | +git reset --hard upstream/main |
| 38 | +conda clean --all --y |
| 39 | +# TODO: previous iterations of this script had issues with activating conda environments |
| 40 | +conda env create -f conda/dev.yml -n ${ZI_DEV} |
| 41 | +conda activate ${ZI_DEV} |
| 42 | +pip install . |
| 43 | +pytest tests/global_time_series/test_*.py |
| 44 | +if [ $? != 0 ]; then |
| 45 | + echo 'ERROR (2): zppy-interfaces unit tests failed' |
| 46 | + exit 2 |
| 47 | +fi |
| 48 | + |
| 49 | +# Set up e3sm_diags env |
26 | 50 | cd ${DIAGS_DIR} |
27 | | -git checkout main |
28 | 51 | git fetch upstream |
| 52 | +git checkout main |
| 53 | +if [ $? != 0 ]; then |
| 54 | + echo 'ERROR (3): Could not check out e3sm_diags main branch' |
| 55 | + exit 3 |
| 56 | +fi |
29 | 57 | 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 |
| 58 | +conda clean --all --y |
| 59 | +conda env create -f conda-env/dev.yml -n ${DIAGS_DEV} |
| 60 | +conda activate ${DIAGS_DEV} |
35 | 61 | pip install . |
36 | | -cd ${ZPPY_DIR} |
37 | 62 |
|
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'. |
| 63 | +# Set up zppy env |
| 64 | +cd ${ZPPY_DIR} |
| 65 | +# We should already be on the branch we want to test! |
| 66 | +conda clean --all --y |
| 67 | +conda env create -f conda/dev.yml -n ${ZPPY_DEV} |
| 68 | +conda activate ${ZPPY_DEV} |
46 | 69 | pip install . |
47 | | - |
48 | | -echo "Run unit tests" |
49 | | -python -u -m unittest tests/test_*.py |
| 70 | +pytest tests/test_*.py |
50 | 71 | if [ $? != 0 ]; then |
51 | | - echo 'ERROR (1): unit tests failed' |
52 | | - exit 1 |
| 72 | + echo 'ERROR (4): zppy unit tests failed' |
| 73 | + exit 4 |
53 | 74 | fi |
54 | 75 |
|
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 |
| 76 | +# Integration testing for zppy |
| 77 | +python tests/integration/utils.py False ${DIAGS_DEV} ${ZI_DEV} |
| 78 | + |
| 79 | + |
| 80 | +zppy -c tests/integration/generated/test_weekly_comprehensive_v3_chrysalis.cfg |
| 81 | +zppy -c tests/integration/generated/test_weekly_comprehensive_v2_chrysalis.cfg |
| 82 | +zppy -c tests/integration/generated/test_weekly_bundles_chrysalis.cfg # Runs 1st part of bundles cfg |
| 83 | + |
| 84 | +# TODO: figure out how to wait for all those jobs to finish |
| 85 | + |
| 86 | +zppy -c tests/integration/generated/test_weekly_bundles_chrysalis.cfg |
| 87 | + |
| 88 | +# TODO: figure out how to wait for all those jobs to finish |
| 89 | + |
| 90 | +# Check output |
| 91 | +cd /lcrc/group/e3sm/${USER}/zppy_weekly_comprehensive_v3_output/${UNIQUE_ID}/v3.LR.historical_0051/post/scripts/ |
67 | 92 | grep -v "OK" *status |
68 | 93 | 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 |
| 94 | + echo 'ERROR (5): weekly_comprehensive_v3 failed' |
| 95 | + exit 5 |
72 | 96 | 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 |
| 97 | + |
| 98 | +cd /lcrc/group/e3sm/${USER}/zppy_weekly_comprehensive_v2_output/${UNIQUE_ID}/v2.LR.historical_0201/post/scripts |
82 | 99 | grep -v "OK" *status |
83 | 100 | 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 |
| 101 | + echo 'ERROR (6): weekly_comprehensive_v2 failed' |
| 102 | + exit 6 |
87 | 103 | 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 |
| 104 | + |
| 105 | +cd /lcrc/group/e3sm/${USER}/zppy_weekly_bundles_output/${UNIQUE_ID}/v3.LR.historical_0051/post/scripts |
94 | 106 | grep -v "OK" *status |
95 | 107 | 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 |
| 108 | + echo 'ERROR (7): weekly_bundles failed' |
| 109 | + exit 7 |
99 | 110 | fi |
100 | | -cd ${ZPPY_DIR} |
101 | 111 |
|
102 | | -echo "Run the integration tests" |
103 | | -python -u -m unittest tests/integration/test_*.py |
| 112 | +# Run integration tests |
| 113 | +cd ~/ez/zppy |
| 114 | +pytest tests/integration/test_*.py |
104 | 115 | if [ $? != 0 ]; then |
105 | | - echo 'ERROR (5): integration tests failed' |
106 | | - exit 5 |
| 116 | + echo 'ERROR (8): zppy integration tests failed' |
| 117 | + exit 8 |
107 | 118 | fi |
108 | | - |
109 | | -echo "All tests passed!" |
|
0 commit comments