91 |
{ |
{ |
92 |
# testoutput_for_prop dir s1 label subdir extension |
# testoutput_for_prop dir s1 label subdir extension |
93 |
# |
# |
94 |
# compares files in $dir/$subdir/output.txt and $dir/results/output.txt |
# compares files $dir/$subdir/$OUTPUTFILE and $dir/results/output.txt |
95 |
# using search strings s1 and text label |
# using search strings s1 and text label |
96 |
|
|
97 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
98 |
echo testoutput_for_prop: grep "$2" $1/$4/output.txt 1>&2 |
echo testoutput_for_prop: grep "$2" $1/$4/$OUTPUTFILE 1>&2 |
99 |
fi |
fi |
100 |
if [ -r $1/$4/output.txt ]; then |
if [ -r $1/$4/$OUTPUTFILE ]; then |
101 |
grep "$2" $1/$4/output.txt | sed 's/.*=//' | cat -n > tmp1.txt |
grep "$2" $1/$4/$OUTPUTFILE | sed 's/.*=//' | cat -n > tmp1.txt |
102 |
lncntA=`wc -l tmp1.txt | awk '{print $1}' ` |
lncntA=`wc -l tmp1.txt | awk '{print $1}' ` |
103 |
if [ $lncntA -lt 3 ]; then |
if [ $lncntA -lt 3 ]; then |
104 |
if [ $verbose -gt 0 ]; then |
if [ $verbose -gt 0 ]; then |
107 |
return 99 |
return 99 |
108 |
fi |
fi |
109 |
else |
else |
110 |
echo testoutput_for_prop: output.txt from model run was not readable 1>&2 |
echo testoutput_for_prop: $OUTPUTFILE from model run was not readable 1>&2 |
111 |
return 99 |
return 99 |
112 |
fi |
fi |
113 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
114 |
echo testoutput_for_prop: grep "$2" $1/results/output.txt$5 1>&2 |
echo testoutput_for_prop: grep "$2" $1/results/output.$5 1>&2 |
115 |
fi |
fi |
116 |
grep "$2" $1/results/output.txt$5 | sed 's/.*=//' | cat -n > tmp2.txt |
grep "$2" $1/results/output.$5 | sed 's/.*=//' | cat -n > tmp2.txt |
117 |
lncntB=`wc -l tmp2.txt | awk '{print $1}' ` |
lncntB=`wc -l tmp2.txt | awk '{print $1}' ` |
118 |
if [ $lncntB -lt 3 ]; then |
if [ $lncntB -lt 3 ]; then |
119 |
if [ $verbose -gt 0 ]; then |
if [ $verbose -gt 0 ]; then |
129 |
fi |
fi |
130 |
has_nan=`cat tmp1.txt | grep -i nan | wc -l` |
has_nan=`cat tmp1.txt | grep -i nan | wc -l` |
131 |
if [ $has_nan -gt 0 ] ; then |
if [ $has_nan -gt 0 ] ; then |
132 |
echo testoutput_for_prop: output.txt contains $has_nan NaN values 1>&2 |
echo testoutput_for_prop: $OUTPUTFILE contains $has_nan NaN values 1>&2 |
133 |
return 99 |
return 99 |
134 |
fi |
fi |
135 |
has_inf=`cat tmp1.txt | grep -i inf | wc -l` |
has_inf=`cat tmp1.txt | grep -i inf | wc -l` |
136 |
if [ $has_inf -gt 0 ] ; then |
if [ $has_inf -gt 0 ] ; then |
137 |
echo testoutput_for_prop: output.txt contains $has_inf Inf values 1>&2 |
echo testoutput_for_prop: $OUTPUTFILE contains $has_inf Inf values 1>&2 |
138 |
return 99 |
return 99 |
139 |
fi |
fi |
140 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
184 |
testoutput_ad() |
testoutput_ad() |
185 |
{ |
{ |
186 |
grep $3 $1/results_ad/output_adm.txt | awk '{print NR " " $5}' > t05.txt |
grep $3 $1/results_ad/output_adm.txt | awk '{print NR " " $5}' > t05.txt |
187 |
grep $3 $1/$2/output_adm.txt | awk '{print NR " " $5}' > t15.txt |
grep $3 $1/$2/$OUTPUTFILE | awk '{print NR " " $5}' > t15.txt |
188 |
grep $3 $1/results_ad/output_adm.txt | awk '{print NR " " $6}' > t06.txt |
grep $3 $1/results_ad/output_adm.txt | awk '{print NR " " $6}' > t06.txt |
189 |
grep $3 $1/$2/output_adm.txt | awk '{print NR " " $6}' > t16.txt |
grep $3 $1/$2/$OUTPUTFILE | awk '{print NR " " $6}' > t16.txt |
190 |
join t05.txt t15.txt > t5.txt |
join t05.txt t15.txt > t5.txt |
191 |
join t06.txt t16.txt > t6.txt |
join t06.txt t16.txt > t6.txt |
192 |
echo "-1" >> t5.txt |
echo "-1" >> t5.txt |
341 |
else |
else |
342 |
( |
( |
343 |
cd $1; |
cd $1; |
344 |
#if test -e output.txt ; then rm -f output.txt ; fi |
#if test -e $OUTPUTFILE ; then rm -f $OUTPUTFILE ; fi |
345 |
if test -r Makefile ; then |
if test -r Makefile ; then |
346 |
printf 'clean build-dir: make Clean ... ' 2>&1 |
printf 'clean build-dir: make Clean ... ' 2>&1 |
347 |
$MAKE Clean >> make.log 2>&1 |
$MAKE Clean >> make.log 2>&1 |
561 |
tail run.log |
tail run.log |
562 |
echo successful 1>&2 |
echo successful 1>&2 |
563 |
# === Reduce the size of the testing emails! |
# === Reduce the size of the testing emails! |
564 |
# if test "x$ADM" = x ; then |
#cp $OUTPUTFILE $CDIR"/"$OUTPUTFILE |
|
# cp output.txt $CDIR"/output.txt" |
|
|
# else |
|
|
# cp output_adm.txt $CDIR"/output_adm.txt" |
|
|
# fi |
|
565 |
if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi |
if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi |
566 |
return 0 |
return 0 |
567 |
else |
else |
843 |
for xx in $TESTDIRS |
for xx in $TESTDIRS |
844 |
do |
do |
845 |
case $xx in |
case $xx in |
846 |
'basic') LIST=${LIST}" aim.5l_cs front_relax global_ocean.90x40x15" |
'basic') LIST=${LIST}" aim.5l_cs hs94.128x64x5 ideal_2D_oce" |
847 |
LIST=${LIST}" hs94.128x64x5 tutorial_barotropic_gyre" |
LIST=${LIST}" lab_sea tutorial_baroclinic_gyre" |
848 |
LIST=${LIST}" tutorial_global_oce_biogeo tutorial_plume_on_slope" |
LIST=${LIST}" tutorial_global_oce_latlon tutorial_plume_on_slope" |
849 |
;; |
;; |
850 |
'tutorials') |
'tutorials') |
851 |
LIST=${LIST}" "`ls | grep 'tutorial_'` ;; |
LIST=${LIST}" "`ls | grep 'tutorial_'` ;; |
879 |
OUTPUTFILE="output.txt" |
OUTPUTFILE="output.txt" |
880 |
fi |
fi |
881 |
|
|
|
if test "x$ADM" = xt -a "x$COMMAND" = x ; then |
|
|
COMMAND="./$EXECUTABLE > $OUTPUTFILE" |
|
|
fi |
|
|
|
|
882 |
if test "x$COMMAND" = x ; then |
if test "x$COMMAND" = x ; then |
883 |
COMMAND="./$EXECUTABLE > $OUTPUTFILE" |
COMMAND="./$EXECUTABLE > $OUTPUTFILE" |
884 |
fi |
fi |
885 |
|
if test "x$MPI" = xt ; then |
886 |
|
OUTPUTFILE="STDOUT.0000" |
887 |
|
fi |
888 |
|
|
889 |
#echo "OK" |
#echo "OK" |
890 |
echo "OK (COMMAND= $COMMAND )" |
echo "OK (COMMAND= $COMMAND )" |
1058 |
#echo "ex_run_dirs='$ex_run_dirs'" |
#echo "ex_run_dirs='$ex_run_dirs'" |
1059 |
for exd in $ex_run_dirs ; do |
for exd in $ex_run_dirs ; do |
1060 |
name=`echo $exd | sed -e 's/input.//g'` |
name=`echo $exd | sed -e 's/input.//g'` |
1061 |
outf="$dir/results/output.txt.$name" |
outf="$dir/results/output.$name.txt" |
1062 |
if test -f $outf -a -r $outf ; then |
if test -f $outf -a -r $outf ; then |
1063 |
if test "x$MULTI_THREAD" = "xt" ; then |
if test "x$MULTI_THREAD" = "xt" ; then |
1064 |
if test -r $dir"/"$exd"/eedata.mth" ; then |
if test -r $dir"/"$exd"/eedata.mth" ; then |
1101 |
&& makemodel $dir/$builddir && make=Y \ |
&& makemodel $dir/$builddir && make=Y \ |
1102 |
&& linkdata $dir/$rundir $input_dirs \ |
&& linkdata $dir/$rundir $input_dirs \ |
1103 |
&& runmodel $dir/$rundir && run=Y \ |
&& runmodel $dir/$rundir && run=Y \ |
1104 |
&& results=`testoutput $dir $rundir` |
&& results=`testoutput $dir $rundir "txt"` |
1105 |
fi |
fi |
1106 |
|
|
1107 |
echo |
echo |
1126 |
run_clean $dir/tr_run.$ex |
run_clean $dir/tr_run.$ex |
1127 |
linkdata $dir/tr_run.$ex input.$ex input |
linkdata $dir/tr_run.$ex input.$ex input |
1128 |
runmodel $dir/tr_run.$ex && run=Y \ |
runmodel $dir/tr_run.$ex && run=Y \ |
1129 |
&& results=`testoutput $dir tr_run.$ex "."$ex` |
&& results=`testoutput $dir tr_run.$ex ${ex}".txt"` |
1130 |
fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}` |
fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}` |
1131 |
fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` |
fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` |
1132 |
fres="$fres.$ex" |
fres="$fres.$ex" |