Skip to content

Commit

Permalink
Merge pull request #258 from cacraigucar/cam_sima_testing
Browse files Browse the repository at this point in the history
Introduce limited CAM-SIMA regression testing
  • Loading branch information
cacraigucar authored May 2, 2024
2 parents 8acd99e + 71d5879 commit 56db6e6
Show file tree
Hide file tree
Showing 15 changed files with 1,124 additions and 0 deletions.
52 changes: 52 additions & 0 deletions cime_config/testdefs/testlist_cam.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0"?>
<testlist version="2.0">

<!-- @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -->
<!-- SIMA TESTS -->
<!-- @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -->


<test compset="FPHYStest" grid="ne3pg3_ne3pg3_mg37" name="SMS_Ln2" testmods="cam/outfrq_kessler_derecho_nooutput/">
<machines>
<machine name="derecho" compiler="intel" category="aux_sima"/>
</machines>
<options>
<option name="wallclock">00:10:00</option>
</options>
</test>
<test compset="FKESSLER" grid="mpasa480_mpasa480" name="SMS_Ln2" testmods="cam/outfrq_kessler_mpas_derecho_nooutput/">
<machines>
<machine name="derecho" compiler="gnu" category="aux_sima"/>
</machines>
<options>
<option name="wallclock">00:10:00</option>
</options>
</test>
<test compset="FPHYStest" grid="ne3pg3_ne3pg3_mg37" name="SMS_Ln2" testmods="cam/outfrq_held_suarez_derecho_nooutput/">
<machines>
<machine name="derecho" compiler="gnu" category="aux_sima"/>
</machines>
<options>
<option name="wallclock">00:10:00</option>
</options>
</test>

<test compset="FPHYStest" grid="ne3pg3_ne3pg3_mg37" name="SMS_Ln2" testmods="cam/outfrq_kessler_izumi_nooutput/">
<machines>
<machine name="izumi" compiler="gnu" category="aux_sima"/>
</machines>
<options>
<option name="wallclock">00:10:00</option>
</options>
</test>
<test compset="FPHYStest" grid="ne3pg3_ne3pg3_mg37" name="SMS_Ln2" testmods="cam/outfrq_held_suarez_izumi_nooutput/">
<machines>
<machine name="izumi" compiler="gnu" category="aux_sima"/>
</machines>
<options>
<option name="wallclock">00:10:00</option>
</options>
</test>


</testlist>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
./xmlchange CAM_CONFIG_OPTS="--dyn none --physics-suites held_suarez_1994"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ncdata=/glade/campaign/cesm/community/amwg/sima_baselines/cam_sima_test_snapshots/cam_ne3pg3_held_suarez_snapshot_derecho_gnu_before.nc
ncdata_check=/glade/campaign/cesm/community/amwg/sima_baselines/cam_sima_test_snapshots/cam_ne3pg3_held_suarez_snapshot_derecho_gnu_after.nc
debug_output=0
pver=30
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
./xmlchange CAM_CONFIG_OPTS="--dyn none --physics-suites held_suarez_1994"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ncdata=/project/amp02/cam_snapshot_files/held_suarez/cam_ne3pg3_held_suarez_snapshot_derecho_gnu_before.nc
ncdata_check=/project/amp02/cam_snapshot_files/held_suarez/cam_ne3pg3_held_suarez_snapshot_derecho_gnu_after.nc
debug_output=0
pver=30
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
./xmlchange CAM_CONFIG_OPTS="--dyn none --physics-suites kessler"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ncdata=/glade/campaign/cesm/community/amwg/sima_baselines/cam_sima_test_snapshots/cam_ne3pg3_kessler_snapshot_derecho_gnu_before.nc
ncdata_check=/glade/campaign/cesm/community/amwg/sima_baselines/cam_sima_test_snapshots/cam_ne3pg3_kessler_snapshot_derecho_gnu_after.nc
debug_output=0
pver=30
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
./xmlchange CAM_CONFIG_OPTS="--dyn none --physics-suites kessler"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ncdata=/project/amp02/cam_snapshot_files/kessler/cam_ne3pg3_kessler_snapshot_derecho_gnu_before.nc
ncdata_check=/project/amp02/cam_snapshot_files/kessler/cam_ne3pg3_kessler_snapshot_derecho_gnu_after.nc
debug_output=0
pver=30
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
./xmlchange CAM_LINKED_LIBS="-lmpas"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
debug_output=0
101 changes: 101 additions & 0 deletions test/system/TGIT.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
#!/bin/sh
# Test for bad git repo
# Ensures that the top-level CAM directory
# has ".git" directory and ".gitignore" file,
# and no other git files or directories.

# Return codes in use:
# 1: Not a git repository
# 2: Missing ".git" directory
# 3: Missing ".gitignore" file
# 4: Missing ".github" directory
# 5: More than three ".git*" files or directories
# 6: Error from running an external command

# Utility to check return code.
# Give it the code and an error message, and it will print stuff and exit.
check_code () {
if [ "$1" -ne 0 ]; then
echo "Error: return code from command was $1"
echo "$2"
exit 6
fi
}

# Little utility for finding absolute path to a directory.
get_dir_abspath () {
echo $(cd $1 && pwd)
}

# Set CAM top-level directory:
cam_top_dir=$(get_dir_abspath ${CAM_ROOT})

# Initialize error variable:
rc=0

# Check to make sure that the top level directory is a git repo:
top_dir_gitinfo=$(git -C "${cam_top_dir}" rev-parse)

# Save error code:
gitinfo_error=$?

# Print error if directory is not a git repository:
if [ "${gitinfo_error}" -ne 0 ]; then
cat <<EOF
The top directory does not appear to be a git repository. Make sure:
1) Git is present on your system and PATH (i.e. "git" exists as a command in your shell).
2) You are running these tests on the correct directory, and
3) The sub-directory ".git" exists in the directory (if not then copy it from a proper CAM git repo).
EOF
rc=1
else # If directory is a git repoistory, then run other tests:

# Check for ".git" directory (i.e., make sure git repo isn't "bare"):
if [ ! -d "${cam_top_dir}/.git" ]; then
cat <<EOF
The ".git" directory is missing from the CAM git repo. Was this repo cloned, copied, or
modified incorrectly? If so then copy the .git directory from a standard CAM git repo.
EOF
rc=2
fi

# Check for ".gitignore" file:
if [ ! -f "${cam_top_dir}/.gitignore" ]; then
cat <<EOF
The ".gitignore" file is missing from the CAM git repo. Was this repo cloned, copied, or
modified incorrectly? If so then copy the .gitignore file from a standard CAM git repo.
EOF
rc=3
fi

# Check for ".github" directory:
if [ ! -d "${cam_top_dir}/.github" ]; then
cat <<EOF
The ".github" directory is missing from the CAM git repo. Was this repo cloned, copied, or
modified incorrectly? If so then copy the .github directory from a standard CAM git repo.
EOF
rc=4
fi

# Check if there are more ".git*" files or directories than just ".git", ".gitignore",
# and ".github":
git_file_num=$(find "${cam_top_dir}" -maxdepth 1 -name '.git*' | wc -l)

check_code "$?" "Problem running 'find' command for multi-git file check."

if [ "${git_file_num}" -gt 3 ]; then
cat <<EOF
More than three ".git*" files or sub-directories present in this CAM git repo.
EOF
rc=5
fi

fi # git-repo check

# If all tests pass, let user know:
if [ "$rc" -eq 0 ]; then
echo "No problems found in the git repostiory ($cam_top_dir)."
fi

# Exit script with final error value:
exit $rc
141 changes: 141 additions & 0 deletions test/system/TR8.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
#!/bin/sh
# Test for missing r8
#


# Check physics
if [ -d "${CAM_ROOT}/components/cam" ]; then

ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/components/cam/src/physics/cam
rc=$?
ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/components/cam/src/physics/camrt
rc=`expr $? + $rc`
ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/components/cam/src/physics/rrtmg -s aer_src
rc=`expr $? + $rc`
ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/components/cam/src/physics/simple
rc=`expr $? + $rc`
ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/components/cam/src/physics/waccm
rc=`expr $? + $rc`
ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/components/cam/src/physics/waccmx
rc=`expr $? + $rc`

else

ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/src/physics/cam
rc=$?
ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/src/physics/camrt
rc=`expr $? + $rc`
ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/src/physics/rrtmg -s aer_src
rc=`expr $? + $rc`
ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/src/physics/simple
rc=`expr $? + $rc`
ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/src/physics/waccm
rc=`expr $? + $rc`
ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/src/physics/waccmx
rc=`expr $? + $rc`
ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/src/infrastructure
rc=`expr $? + $rc`

fi

#Check Ionosphere
if [ -d "${CAM_ROOT}/components/cam" ]; then

ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/components/cam/src/ionosphere
rc=`expr $? + $rc`

else

ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/src/ionosphere
rc=`expr $? + $rc`

fi

#Check Chemistry
if [ -d "${CAM_ROOT}/components/cam" ]; then

ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/components/cam/src/chemistry -s geoschem
rc=`expr $? + $rc`

else

ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/src/chemistry -s geoschem
rc=`expr $? + $rc`

fi

#Check Dynamics
if [ -d "${CAM_ROOT}/components/cam" ]; then

ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/components/cam/src/dynamics/fv3 -s atmos_cubed_sphere,microphys
rc=`expr $? + $rc`
ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/components/cam/src/dynamics/se
rc=`expr $? + $rc`
ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/components/cam/src/dynamics/fv
rc=`expr $? + $rc`
ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/components/cam/src/dynamics/eul
rc=`expr $? + $rc`
ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/components/cam/src/dynamics/mpas -s dycore
rc=`expr $? + $rc`

else

ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/src/dynamics/fv3 -s atmos_cubed_sphere,microphys
rc=`expr $? + $rc`
ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/src/dynamics/se
rc=`expr $? + $rc`
ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/src/dynamics/fv
rc=`expr $? + $rc`
ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/src/dynamics/eul
rc=`expr $? + $rc`
ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/src/dynamics/mpas -s dycore
rc=`expr $? + $rc`

fi

#Check other
if [ -d "${CAM_ROOT}/components/cam" ]; then

ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/components/cam/src/advection
rc=`expr $? + $rc`
ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/components/cam/src/control
rc=`expr $? + $rc`
ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/components/cam/src/utils
rc=`expr $? + $rc`

else

ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/src/advection
rc=`expr $? + $rc`
ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/src/control
rc=`expr $? + $rc`
ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/src/utils
rc=`expr $? + $rc`

fi

#Check coupler
if [ -d "${CAM_ROOT}/components/cam" ]; then

ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/components/cam/src/cpl
rc=`expr $? + $rc`



else

ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/src/cpl
rc=`expr $? + $rc`

fi

echo $rc

if [ $rc = 255 ]; then
rc=1
fi



echo $rc
exit $rc
Loading

0 comments on commit 56db6e6

Please sign in to comment.