/[MITgcm]/MITgcm/verification/testreport
ViewVC logotype

Diff of /MITgcm/verification/testreport

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.83 by jmc, Wed Jul 5 22:39:57 2006 UTC revision 1.88 by jmc, Tue Aug 29 00:18:35 2006 UTC
# Line 18  usage() Line 18  usage()
18      echo "  (-optfile=|-of=)STRING   list of optfiles to use"      echo "  (-optfile=|-of=)STRING   list of optfiles to use"
19      echo "  (-a|-addr) STRING        list of email recipients"      echo "  (-a|-addr) STRING        list of email recipients"
20      echo "                             (DEF=\"edhill@mitgcm.org\")"      echo "                             (DEF=\"edhill@mitgcm.org\")"
21      echo "  (-t|-tdir) STRING        list of test dirs to use"      echo "  (-t|-tdir) STRING        list of group and/or exp. dirs to test"
22      echo "                             (DEF=\"\" which builds all)"      echo "                             (recognized groups: basic, tutorials)"
23        echo "                             (DEF=\"\" which test all)"
24      echo "  (-b|-bash) STRING        preferred location of a \"bash\" or"      echo "  (-b|-bash) STRING        preferred location of a \"bash\" or"
25      echo "                             Bourne-compatible \"sh\" shell"      echo "                             Bourne-compatible \"sh\" shell"
26      echo "                             (DEF=\"\" for \"bash\")"      echo "                             (DEF=\"\" for \"bash\")"
# Line 90  testoutput_for_prop() Line 91  testoutput_for_prop()
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
# Line 106  testoutput_for_prop() Line 107  testoutput_for_prop()
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
# Line 128  testoutput_for_prop() Line 129  testoutput_for_prop()
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
# Line 183  dashnum() Line 184  dashnum()
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
# Line 340  makeclean() Line 341  makeclean()
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
# Line 535  runmodel() Line 536  runmodel()
536          printf 'runmodel in %s ...' $1 1>&2          printf 'runmodel in %s ...' $1 1>&2
537          # make output.txt          # make output.txt
538          echo          echo
         rm -f run.log  
539          if test ! -x $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then          if test ! -x $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then
540              echo " link" $EXECUTABLE "from dir ../"$builddir > run.log              echo " link" $EXECUTABLE "from dir ../"$builddir > run.log_00
541              ln -sf "../"$builddir"/"$EXECUTABLE .              ln -sf "../"$builddir"/"$EXECUTABLE .
         else  
             touch run.log  
542          fi          fi
543          if test ! -x $EXECUTABLE ; then          if test ! -x $EXECUTABLE ; then
544                    rm -f run.log ; touch run.log
545                    if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi
546                  echo " no executable:" $EXECUTABLE >> run.log                  echo " no executable:" $EXECUTABLE >> run.log
547                  RETVAL=8                  RETVAL=8
548                    ENDVAL=-1
549          else          else
550              if test $OUTPUTFILE -ot $EXECUTABLE ; then              if test $OUTPUTFILE -ot $EXECUTABLE ; then
551                    rm -f run.log ; touch run.log
552                    if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi
553                  ( eval $COMMAND ) >> run.log 2>&1                  ( eval $COMMAND ) >> run.log 2>&1
554                  RETVAL=$?                  RETVAL=$?
555              else              else
                 echo " $OUTPUTFILE is up to date " >> run.log 2>&1  
556                  RETVAL=0                  RETVAL=0
557                    if test -f run.log ; then
558                        if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi
559                        echo "---------->> $OUTPUTFILE is up to date " >> run.log 2>&1
560                    else
561                        touch run.log
562                        if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi
563                        echo "---------->> $OUTPUTFILE is up to date " >> run.log 2>&1
564                        echo " no previous run.log: assume NORMAL END" >> run.log 2>&1
565                    fi
566              fi              fi
567                ENDVAL=`cat run.log | grep -v 'ABNORMAL END' | grep -c 'NORMAL END'`
568          fi          fi
569          # echo "COMMAND='$COMMAND'"          rm -f run.log_00
570          # echo "pwd='"`pwd`"'"          #if test "x$RETVAL" = x0 ; then
571          if test "x$RETVAL" = x0 ; then          if [ $RETVAL -eq 0 -a $ENDVAL -gt 0 ] ; then
572              tail run.log              tail run.log
573              echo successful 1>&2              echo successful 1>&2
574              # === Reduce the size of the testing emails!              # === Reduce the size of the testing emails!
575              # 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  
576              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
577              return 0              return 0
578          else          else
579              tail run.log              tail run.log
580              echo failed 1>&2              echo failed '(run:' $RETVAL ' end:' $ENDVAL ')' 1>&2
581              cp run.log $CDIR"/run.log"              cp run.log $CDIR"/run.log"
582              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
583              return 1              return 1
# Line 840  if test "x$TESTDIRS" = x ; then Line 848  if test "x$TESTDIRS" = x ; then
848      else      else
849          TESTDIRS=`scandirs results`          TESTDIRS=`scandirs results`
850      fi      fi
851    else
852        #- expand group of experiments:
853        LIST=" "
854        for xx in $TESTDIRS
855        do
856          case $xx in
857            'basic') LIST=${LIST}" aim.5l_cs hs94.128x64x5 ideal_2D_oce"
858                     LIST=${LIST}" lab_sea tutorial_baroclinic_gyre"
859                     LIST=${LIST}" tutorial_global_oce_latlon tutorial_plume_on_slope"
860                    ;;
861            'tutorials')
862                     LIST=${LIST}" "`ls | grep 'tutorial_'` ;;
863            *)       LIST=${LIST}" "$xx ;;
864          esac
865        done
866        #echo 'LIST='${LIST}'<'
867        #- remove duplicate and non-directory:
868        TESTDIRS=" "
869        for xx in $LIST
870        do
871            if test -d $xx ; then
872                yy=`echo $TESTDIRS | grep -c $xx`
873                if test $yy = 0 ; then TESTDIRS=${TESTDIRS}" "$xx ; fi
874            else
875                echo " -- skip \"$xx\" : not a directory !"
876            fi
877        done
878  fi  fi
879    #echo 'TESTDIRS='${TESTDIRS}'<'
880    
881  if test "x$OPTFILE" = xNONE -a "x$MITGCM_OF" != x ; then  if test "x$OPTFILE" = xNONE -a "x$MITGCM_OF" != x ; then
882      OPTFILE=$MITGCM_OF      OPTFILE=$MITGCM_OF
# Line 854  else Line 890  else
890      OUTPUTFILE="output.txt"      OUTPUTFILE="output.txt"
891  fi  fi
892    
 if test "x$ADM" = xt -a "x$COMMAND" = x ; then  
     COMMAND="./$EXECUTABLE > $OUTPUTFILE"  
 fi  
   
893  if test "x$COMMAND" = x ; then  if test "x$COMMAND" = x ; then
894      COMMAND="./$EXECUTABLE > $OUTPUTFILE"      COMMAND="./$EXECUTABLE > $OUTPUTFILE"
895  fi  fi
896    if test "x$MPI" = xt ; then
897        OUTPUTFILE="STDOUT.0000"
898    fi
899    
900  #echo "OK"  #echo "OK"
901  echo "OK (COMMAND= $COMMAND )"  echo "OK (COMMAND= $COMMAND )"
# Line 1034  for dir in $TESTDIRS ; do Line 1069  for dir in $TESTDIRS ; do
1069          #echo "ex_run_dirs='$ex_run_dirs'"          #echo "ex_run_dirs='$ex_run_dirs'"
1070          for exd in $ex_run_dirs ; do          for exd in $ex_run_dirs ; do
1071              name=`echo $exd | sed -e 's/input.//g'`              name=`echo $exd | sed -e 's/input.//g'`
1072              outf="$dir/results/output.txt.$name"              outf="$dir/results/output.$name.txt"
1073              if test -f $outf -a -r $outf ; then              if test -f $outf -a -r $outf ; then
1074                  if test "x$MULTI_THREAD" = "xt" ; then                  if test "x$MULTI_THREAD" = "xt" ; then
1075                      if test -r $dir"/"$exd"/eedata.mth" ; then                      if test -r $dir"/"$exd"/eedata.mth" ; then
# Line 1077  for dir in $TESTDIRS ; do Line 1112  for dir in $TESTDIRS ; do
1112              && makemodel $dir/$builddir && make=Y \              && makemodel $dir/$builddir && make=Y \
1113              && linkdata $dir/$rundir $input_dirs \              && linkdata $dir/$rundir $input_dirs \
1114              && runmodel $dir/$rundir && run=Y \              && runmodel $dir/$rundir && run=Y \
1115              && results=`testoutput $dir $rundir`              && results=`testoutput $dir $rundir "txt"`
1116      fi      fi
1117            
1118      echo      echo
# Line 1102  for dir in $TESTDIRS ; do Line 1137  for dir in $TESTDIRS ; do
1137              run_clean $dir/tr_run.$ex              run_clean $dir/tr_run.$ex
1138              linkdata $dir/tr_run.$ex input.$ex input              linkdata $dir/tr_run.$ex input.$ex input
1139              runmodel $dir/tr_run.$ex && run=Y \              runmodel $dir/tr_run.$ex && run=Y \
1140                  && results=`testoutput $dir tr_run.$ex "."$ex`                  && results=`testoutput $dir tr_run.$ex ${ex}".txt"`
1141              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}`
1142              fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`              fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`
1143              fres="$fres.$ex"              fres="$fres.$ex"

Legend:
Removed from v.1.83  
changed lines
  Added in v.1.88

  ViewVC Help
Powered by ViewVC 1.1.22