Skip to content

Commit

Permalink
Add utility for updating ctest input files during development (#202)
Browse files Browse the repository at this point in the history
This PR adds a simple shell script based on `rrfs-test/CMakeLists.txt`
that allows developers to update the RRFS ctests in RDASApp. The goal
here is to be able to run this quick script if making any changes to the
yaml files, test reference files, or input data for the ctests.
Previously, the only way to do this was to rebuild all of RDASApp or
make temporary changes to `build.sh`

Please see
#184 (comment) for
additional motivation.

Note: this script cannot update the ctest configuration (number of
tests, test names, or MPI configuration) since those options are handled
by `ecbuild` during the cmake step.
  • Loading branch information
SamuelDegelia-NOAA authored Oct 18, 2024
1 parent 4224998 commit 06de5e2
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions rrfs-test/ush/update_ctest_inputs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/bin/bash

# This script is designed as a standalone version of rrfs-test/CMakeLists.txt
# Running this will update the input files (data, yamls, etc.) for each ctest
# Note that the ctest configurations (test names, mpi_args) are not updated here

DYCORE="BOTH" # [FV3JEDI, MPASJEDI, BOTH]

# FV3-JEDI tests
rrfs_fv3jedi_tests=(
"rrfs_fv3jedi_hyb_2022052619"
"rrfs_fv3jedi_letkf_2022052619"
)

# MPAS-JEDI tests
rrfs_mpasjedi_tests=(
"rrfs_mpasjedi_2024052700_Ens3Dvar"
"rrfs_mpasjedi_2024052700_getkf_observer"
"rrfs_mpasjedi_2024052700_getkf_solver"
"rrfs_mpasjedi_2024052700_bumploc"
)

echo "Use test data from rrfs-test-data repository"
RDASApp=$( git rev-parse --show-toplevel 2>/dev/null )
CMAKE_SOURCE_DIR=${RDASApp}/bundle
CMAKE_CURRENT_BINARY_DIR=${RDASApp}/build/rrfs-test
rrfs_test_data_local=${CMAKE_SOURCE_DIR}/rrfs-test-data/
src_yaml=${CMAKE_SOURCE_DIR}/rrfs-test/testinput

if [[ $DYCORE == "FV3JEDI" || $DYCORE == "BOTH" ]]; then
for ctest in "${rrfs_fv3jedi_tests[@]}"; do
case=${ctest}
echo "Updating ${case}..."
casedir=${CMAKE_CURRENT_BINARY_DIR}/rundir-${case}
src_casedir=${rrfs_test_data_local}/rrfs-data_fv3jedi_2022052619
ln -snf ${src_casedir}/DataFix ${casedir}/DataFix
ln -snf ${src_casedir}/Data_static ${casedir}/Data_static
ln -snf ${src_casedir}/INPUT ${casedir}/INPUT
ln -snf ${src_casedir}/Data ${casedir}/Data
ln -snf ${CMAKE_SOURCE_DIR}/rrfs-test/testoutput ${casedir}/testoutput
cp ${src_yaml}/${case}.yaml ${casedir}
done
fi

if [[ $DYCORE == "MPASJEDI" || $DYCORE == "BOTH" ]]; then
for ctest in "${rrfs_mpasjedi_tests[@]}"; do
case=${ctest}
echo "Updating ${case}..."
casedir=${CMAKE_CURRENT_BINARY_DIR}/rundir-${case}
src_casedir=${rrfs_test_data_local}/rrfs-data_mpasjedi_2024052700
ln -snf ${src_casedir}/data ${casedir}/data
ln -snf ${src_casedir}/graphinfo ${casedir}/graphinfo
ln -snf ${src_casedir}/stream_list ${casedir}/stream_list
ln -snf ${CMAKE_SOURCE_DIR}/rrfs-test/testoutput ${casedir}/testoutput
cp ${src_casedir}/streams.atmosphere ${casedir}
cp ${src_casedir}/namelist.atmosphere ${casedir}
cp ${src_casedir}/geovars.yaml ${casedir}
cp ${src_casedir}/keptvars.yaml ${casedir}
cp ${src_casedir}/obsop_name_map.yaml ${casedir}
for bl_FILE in ${src_casedir}/*.*BL; do
ln -snf ${bl_FILE} ${casedir}/$(basename $bl_FILE)
done
cp ${src_yaml}/${case}.yaml ${casedir}
done
fi

echo "All done."

0 comments on commit 06de5e2

Please sign in to comment.