Skip to content

Commit e76f958

Browse files
committed
Add SPL test
1 parent b6d38ad commit e76f958

File tree

2 files changed

+186
-1
lines changed

2 files changed

+186
-1
lines changed
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
2+
#======================================================================
3+
# Test setup:
4+
#======================================================================
5+
6+
cd $CASEROOT
7+
8+
# turn on memory leak check - if comparing with baseline also
9+
# compare memory highwater mark from baseline
10+
set DETECT_MEMORY_LEAK
11+
if ($?COMPARE_BASELINE ) then
12+
set COMPARE_MEMORY
13+
set COMPARE_THROUGHPUT
14+
endif
15+
16+
#--- clone the main case to create ref1 case
17+
set CASER0 = ${CASEROOT}.ref1
18+
set CASERR1 = ${CASEROOT}
19+
set CASE0 = ${CASE}
20+
21+
cd $CASER0
22+
set STOP_N = `./xmlquery STOP_N -value`
23+
set STOP_OPTION = `./xmlquery STOP_OPTION -value`
24+
25+
@ stopnf = ${STOP_N}
26+
@ stopn1 = ${STOP_N} / 2
27+
@ stopn2 = ${stopnf} - $stopn1
28+
29+
cd $CIMEROOT/scripts
30+
rm -r -f ${CASERR1}; ./create_clone -case ${CASERR1} -clone ${CASER0}
31+
32+
cd $CASERR1
33+
./xmlchange -file env_build.xml -id EXEROOT -val ${EXEROOT} || exit -1
34+
./xmlchange -file env_build.xml -id BUILD_COMPLETE -val TRUE || exit -1
35+
./case_setup -testmode
36+
37+
#======================================================================
38+
# (1) Test run: do a spinup run in the ref1 case
39+
#======================================================================
40+
41+
cd $CASER0
42+
43+
echo "" >>& $TESTSTATUS_LOG
44+
echo "doing a ${stopn1} ${STOP_OPTION} initial spinup test, writing restarts at end of run" >>& $TESTSTATUS_LOG
45+
echo " short term archiving is on" >>& $TESTSTATUS_LOG
46+
47+
# set up run
48+
set DOUT_S_ROOT = `./xmlquery DOUT_S_ROOT -value`
49+
set DOUTSR0 = $DOUT_S_ROOT
50+
set CASE = `./xmlquery CASE -value`
51+
./xmlchange -file env_run.xml -id STOP_N -val ${stopn1} || exit -1
52+
./xmlchange -file env_run.xml CLM_ACCELERATED_SPINUP=on || exit -1
53+
54+
./case.run
55+
if ($status != 0) then
56+
echo " ERROR: case.run failed" >>& $TESTSTATUS_LOG
57+
exit -1
58+
endif
59+
60+
# Run the short-term archiver.. this is a short-term hack until
61+
# a better solution can be found.
62+
./case.st_archive
63+
if($status != 0) then
64+
echo " ERROR: case.st_archive failed ">>& $TESTSTATUS_LOG
65+
exit -1
66+
endif
67+
68+
# must look in short term archiving directory for cpl log files
69+
set CplLogFile = `ls -1t $DOUT_S_ROOT/cpl/logs/cpl.log* | head -1`
70+
if ( $?CplLogFile ) then
71+
if (-e $CplLogFile) then
72+
set pass = `zgrep "SUCCESSFUL TERMINATION" $CplLogFile | wc -l`
73+
if ($pass != 1) then
74+
echo "ERROR: coupler log $CplLogFile indicates model run failed" >>& $TESTSTATUS_LOG
75+
exit -1
76+
else
77+
echo "Success: test log is $CplLogFile" >>& $TESTSTATUS_LOG
78+
endif
79+
endif
80+
else
81+
echo "ERROR: no coupler log created, model run failed" >>& $TESTSTATUS_LOG
82+
exit -1
83+
endif
84+
85+
echo "" >>& $TESTSTATUS_LOG
86+
echo "moving relevant history files to suffix with command " >>& $TESTSTATUS_LOG
87+
echo "$SCRIPTSROOT/Tools/component_compare_move.sh -rundir $RUNDIR -testcase $CASE -suffix spinup $add_iop" >>& $TESTSTATUS_LOG
88+
echo "" >>& $TESTSTATUS_LOG
89+
90+
$SCRIPTSROOT/Tools/component_compare_move.sh -rundir $RUNDIR -testcase $CASE -suffix "spinup" $add_iop
91+
92+
#======================================================================
93+
# (2) Test run: do the final non-spinup run in the cloned main case
94+
#======================================================================
95+
96+
cd ${CASERR1}
97+
98+
echo "" >>& $TESTSTATUS_LOG
99+
echo "doing a ${stopn2} ${STOP_OPTION} final spinup test" >>& $TESTSTATUS_LOG
100+
echo " short term archiving is off" >>& $TESTSTATUS_LOG
101+
102+
# determine refdate for run
103+
set RUNDIR = `./xmlquery RUNDIR -value`
104+
mkdir -p $RUNDIR
105+
set refdate = `ls -1dt ${DOUTSR0}/rest/*-00000* | head -1 | sed "s/-00000.*//" | sed "s/^.*rest\///" ` || exit -1
106+
ln -s ${DOUTSR0}/rest/${refdate}-00000/*${refdate}* $RUNDIR/.
107+
108+
# set up run
109+
./xmlchange RUN_TYPE="hybrid"
110+
./xmlchange GET_REFCASE=FALSE
111+
./xmlchange RUN_REFCASE=$CASE0
112+
./xmlchange RUN_REFDATE=${refdate}
113+
./xmlchange STOP_N=${stopn2}
114+
./xmlchange DOUT_S=FALSE
115+
./xmlchange -file env_run.xml CLM_ACCELERATED_SPINUP=off || exit -1
116+
117+
set CASE = `./xmlquery CASE -value`
118+
119+
./case.run
120+
if ($status != 0) then
121+
echo " ERROR: case.run failed" >>& $TESTSTATUS_LOG
122+
exit -1
123+
endif
124+
125+
# since short term archiving is off, must now look in $RUNDIR for cpl log files
126+
set CplLogFile = `ls -1t $RUNDIR/cpl.log* | head -1`
127+
if ( $?CplLogFile ) then
128+
if (-e $CplLogFile) then
129+
set pass = `zgrep "SUCCESSFUL TERMINATION" $CplLogFile | wc -l`
130+
if ($pass != 1) then
131+
echo "ERROR: coupler log $CplLogFile indicates model run failed" >>& $TESTSTATUS_LOG
132+
exit -1
133+
else
134+
echo "Success: test log is $CplLogFile" >>& $TESTSTATUS_LOG
135+
endif
136+
endif
137+
else
138+
echo "ERROR: no coupler log created, model run failed" >>& $TESTSTATUS_LOG
139+
exit -1
140+
endif
141+
142+
echo "" >>& $TESTSTATUS_LOG
143+
echo "moving relevant history files to suffix with command " >>& $TESTSTATUS_LOG
144+
echo "$SCRIPTSROOT/Tools/component_compare_move.sh -rundir $RUNDIR -testcase $CASE -suffix base $add_iop" >>& $TESTSTATUS_LOG
145+
echo "" >>& $TESTSTATUS_LOG
146+
147+
# the following line creates the component history files used in comparison to baselines
148+
$SCRIPTSROOT/Tools/component_compare_move.sh -rundir $RUNDIR -testcase "$CASE" -suffix "base" $add_iop
149+
150+
#======================================================================
151+
# Test status check:
152+
#======================================================================
153+
154+
set CPLLOG = $CplLogFile
155+
156+
if ! ( $?IOP_ON ) then
157+
echo "DONE ${CASEBASEID} : (test finished, successful coupler log) " >&! $TESTSTATUS_OUT
158+
echo " --- Test Functionality: ---" >>& $TESTSTATUS_OUT
159+
endif
160+
161+
echo "done ${CASEBASEID} : ($msg finished, successful coupler log) " >>& $TESTSTATUS_LOG
162+
echo "" >>& $TESTSTATUS_LOG
163+
164+
if ( $?IOP_ON ) then
165+
# note that suffix2 is none - since there is no functionality that
166+
# this test performs other than running
167+
# by setting the suffix to none - will not be generating any comparisions
168+
# other than the iop comparison for the base case
169+
$SCRIPTSROOT/Tools/component_compare_test.sh -rundir $RUNDIR -testcase $CASE -testcase_base $CASEBASEID -suffix1 base -suffix2 none $add_iop -msg "$msg" >>& $TESTSTATUS_OUT
170+
else
171+
echo "PASS ${CASEBASEID} : successful coupler log " >>& $TESTSTATUS_OUT
172+
echo "PASS ${CASEBASEID} : test functionality summary " >>& $TESTSTATUS_OUT
173+
endif
174+
175+

scripts/Testing/Testcases/config_tests.xml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,17 @@
206206
</test>
207207

208208
<test NAME="SSP">
209-
<DESC>smoke CLM spinup test (only valid for CLM compsets with CLM45 and CN or BGC)</DESC>
209+
<DESC>smoke CLM spinup test (only valid for CLM45 or CLM50 compsets)</DESC>
210+
<INFO_DBUG>1</INFO_DBUG>
211+
<CCSM_TCOST>-1</CCSM_TCOST>
212+
<STOP_OPTION>ndays</STOP_OPTION>
213+
<RUN_TYPE>startup</RUN_TYPE>
214+
<STOP_N>4</STOP_N>
215+
<DOUT_S>FALSE</DOUT_S>
216+
</test>
217+
218+
<test NAME="SPL">
219+
<DESC>smoke CLM spinup test (only valid for CLM45 or CLM50 compsets)</DESC>
210220
<INFO_DBUG>1</INFO_DBUG>
211221
<CCSM_TCOST>-1</CCSM_TCOST>
212222
<STOP_OPTION>ndays</STOP_OPTION>

0 commit comments

Comments
 (0)