/[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.89 by jmc, Wed Jan 10 22:50:09 2007 UTC
# Line 15  usage() Line 15  usage()
15      echo "  (-mpi)                   compile and run using MPI"      echo "  (-mpi)                   compile and run using MPI"
16      echo "  (-ieee|-noieee)          if possible, use IEEE compiler flags"      echo "  (-ieee|-noieee)          if possible, use IEEE compiler flags"
17      echo "                             (DEF=\"-ieee\")"      echo "                             (DEF=\"-ieee\")"
18      echo "  (-optfile=|-of=)STRING   list of optfiles to use"      echo "  (-of=|-optfile=)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 "  (-skd|-skipdir) STRING   list of exp. dirs to skip"
25        echo "                             (DEF=\"\" which test all)"
26      echo "  (-b|-bash) STRING        preferred location of a \"bash\" or"      echo "  (-b|-bash) STRING        preferred location of a \"bash\" or"
27      echo "                             Bourne-compatible \"sh\" shell"      echo "                             Bourne-compatible \"sh\" shell"
28      echo "                             (DEF=\"\" for \"bash\")"      echo "                             (DEF=\"\" for \"bash\")"
# Line 30  usage() Line 33  usage()
33      echo "                             (DEF=\"make\")"      echo "                             (DEF=\"make\")"
34      echo "  (-odir) STRING           used to build output directory name"      echo "  (-odir) STRING           used to build output directory name"
35      echo "                             (DEF=\"hostname\")"      echo "                             (DEF=\"hostname\")"
36      echo "  (-ptracers|-ptr) STRING  specify which ptracers to test"      echo "  (-ptr|-ptracers) STRING  specify which ptracers to test"
37      echo "                             (DEF=\"1 2 3 4 5\")"      echo "                             (DEF=\"1 2 3 4 5\")"
38      echo "  (-j) JOBS                use \"make -j JOBS\" for parallel builds"      echo "  (-j) JOBS                use \"make -j JOBS\" for parallel builds"
39      echo "  (-clean)                 *ONLY* run \"make CLEAN\""      echo "  (-clean)                 *ONLY* run \"make CLEAN\""
40      echo "  (-quick|-q)              same as \"-nogenmake -noclean -nodepend\""      echo "  (-q|-quick)              same as \"-nogenmake -noclean -nodepend\""
41      echo "  (-nogenmake|-ng)         skip the genmake stage"      echo "  (-ng|-nogenmake)         skip the genmake stage"
42      echo "  (-noclean|-nc)           skip the \"make clean\" stage"      echo "  (-nc|-noclean)           skip the \"make clean\" stage"
43      echo "  (-nodepend|-nd)          skip the \"make depend\" stage"      echo "  (-nd|-nodepend)          skip the \"make depend\" stage"
44      echo "  (-deldir|-dd)            on success, delete the output directory"      echo "  (-dd|-deldir)            on success, delete the output directory"
45      echo      echo
46      echo "and where STRING can be a whitespace-delimited list"      echo "and where STRING can be a whitespace-delimited list"
47      echo "such as:"      echo "such as:"
# Line 90  testoutput_for_prop() Line 93  testoutput_for_prop()
93  {  {
94      # testoutput_for_prop dir s1 label subdir extension      # testoutput_for_prop dir s1 label subdir extension
95      #      #
96      #  compares files in $dir/$subdir/output.txt and $dir/results/output.txt      #  compares files $dir/$subdir/$OUTPUTFILE and $dir/results/output.txt
97      #  using search strings s1 and text label      #  using search strings s1 and text label
98    
99      if [ $debug -gt 0 ]; then      if [ $debug -gt 0 ]; then
100          echo testoutput_for_prop: grep "$2" $1/$4/output.txt 1>&2          echo testoutput_for_prop: grep "$2" $1/$4/$OUTPUTFILE 1>&2
101      fi      fi
102      if [ -r $1/$4/output.txt ]; then      if [ -r $1/$4/$OUTPUTFILE ]; then
103          grep "$2" $1/$4/output.txt | sed 's/.*=//' | cat -n > tmp1.txt          grep "$2" $1/$4/$OUTPUTFILE | sed 's/.*=//' | cat -n > tmp1.txt
104          lncntA=`wc -l tmp1.txt | awk '{print $1}' `          lncntA=`wc -l tmp1.txt | awk '{print $1}' `
105          if [ $lncntA -lt 3 ]; then          if [ $lncntA -lt 3 ]; then
106              if [ $verbose -gt 0 ]; then              if [ $verbose -gt 0 ]; then
# Line 106  testoutput_for_prop() Line 109  testoutput_for_prop()
109              return 99              return 99
110          fi          fi
111      else      else
112          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
113          return 99          return 99
114      fi      fi
115      if [ $debug -gt 0 ]; then      if [ $debug -gt 0 ]; then
116          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
117      fi      fi
118      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
119      lncntB=`wc -l tmp2.txt | awk '{print $1}' `      lncntB=`wc -l tmp2.txt | awk '{print $1}' `
120      if [ $lncntB -lt 3 ]; then      if [ $lncntB -lt 3 ]; then
121          if [ $verbose -gt 0 ]; then          if [ $verbose -gt 0 ]; then
# Line 128  testoutput_for_prop() Line 131  testoutput_for_prop()
131      fi      fi
132      has_nan=`cat tmp1.txt | grep -i nan | wc -l`      has_nan=`cat tmp1.txt | grep -i nan | wc -l`
133      if [ $has_nan -gt 0  ] ; then      if [ $has_nan -gt 0  ] ; then
134          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
135          return 99          return 99
136      fi      fi
137      has_inf=`cat tmp1.txt | grep -i inf | wc -l`      has_inf=`cat tmp1.txt | grep -i inf | wc -l`
138      if [ $has_inf -gt 0  ] ; then      if [ $has_inf -gt 0  ] ; then
139          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
140          return 99          return 99
141      fi      fi
142      if [ $debug -gt 0 ]; then      if [ $debug -gt 0 ]; then
# Line 183  dashnum() Line 186  dashnum()
186  testoutput_ad()  testoutput_ad()
187  {  {
188      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
189      grep $3 $1/$2/output_adm.txt | awk '{print NR " " $5}' > t15.txt      grep $3 $1/$2/$OUTPUTFILE | awk '{print NR " " $5}' > t15.txt
190      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
191      grep $3 $1/$2/output_adm.txt | awk '{print NR " " $6}' > t16.txt      grep $3 $1/$2/$OUTPUTFILE | awk '{print NR " " $6}' > t16.txt
192      join t05.txt t15.txt > t5.txt      join t05.txt t15.txt > t5.txt
193      join t06.txt t16.txt > t6.txt      join t06.txt t16.txt > t6.txt
194      echo "-1" >> t5.txt      echo "-1" >> t5.txt
# Line 340  makeclean() Line 343  makeclean()
343      else      else
344          (          (
345              cd $1;              cd $1;
346              #if test -e output.txt ; then rm -f output.txt ; fi              #if test -e $OUTPUTFILE ; then rm -f $OUTPUTFILE ; fi
347              if test -r Makefile ; then              if test -r Makefile ; then
348                  printf 'clean build-dir: make Clean ... ' 2>&1                  printf 'clean build-dir: make Clean ... ' 2>&1
349                  $MAKE Clean >> make.log 2>&1                  $MAKE Clean >> make.log 2>&1
# Line 535  runmodel() Line 538  runmodel()
538          printf 'runmodel in %s ...' $1 1>&2          printf 'runmodel in %s ...' $1 1>&2
539          # make output.txt          # make output.txt
540          echo          echo
         rm -f run.log  
541          if test ! -x $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then          if test ! -x $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then
542              echo " link" $EXECUTABLE "from dir ../"$builddir > run.log              echo " link" $EXECUTABLE "from dir ../"$builddir > run.log_00
543              ln -sf "../"$builddir"/"$EXECUTABLE .              ln -sf "../"$builddir"/"$EXECUTABLE .
         else  
             touch run.log  
544          fi          fi
545          if test ! -x $EXECUTABLE ; then          if test ! -x $EXECUTABLE ; then
546                    rm -f run.log ; touch run.log
547                    if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi
548                  echo " no executable:" $EXECUTABLE >> run.log                  echo " no executable:" $EXECUTABLE >> run.log
549                  RETVAL=8                  RETVAL=8
550                    ENDVAL=-1
551          else          else
552              if test $OUTPUTFILE -ot $EXECUTABLE ; then              if test $OUTPUTFILE -ot $EXECUTABLE ; then
553                    rm -f run.log ; touch run.log
554                    if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi
555                  ( eval $COMMAND ) >> run.log 2>&1                  ( eval $COMMAND ) >> run.log 2>&1
556                  RETVAL=$?                  RETVAL=$?
557              else              else
                 echo " $OUTPUTFILE is up to date " >> run.log 2>&1  
558                  RETVAL=0                  RETVAL=0
559                    if test -f run.log ; then
560                        if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi
561                        echo "---------->> $OUTPUTFILE is up to date " >> run.log 2>&1
562                    else
563                        touch run.log
564                        if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi
565                        echo "---------->> $OUTPUTFILE is up to date " >> run.log 2>&1
566                        echo " no previous run.log: assume NORMAL END" >> run.log 2>&1
567                    fi
568              fi              fi
569                ENDVAL=`cat run.log | grep -v 'ABNORMAL END' | grep -c 'NORMAL END'`
570          fi          fi
571          # echo "COMMAND='$COMMAND'"          rm -f run.log_00
572          # echo "pwd='"`pwd`"'"          #if test "x$RETVAL" = x0 ; then
573          if test "x$RETVAL" = x0 ; then          if [ $RETVAL -eq 0 -a $ENDVAL -gt 0 ] ; then
574              tail run.log              tail run.log
575              echo successful 1>&2              echo successful 1>&2
576              # === Reduce the size of the testing emails!              # === Reduce the size of the testing emails!
577              # 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  
578              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
579              return 0              return 0
580          else          else
581              tail run.log              tail run.log
582              echo failed 1>&2              echo failed '(run:' $RETVAL ' end:' $ENDVAL ')' 1>&2
583              cp run.log $CDIR"/run.log"              cp run.log $CDIR"/run.log"
584              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
585              return 1              return 1
# Line 643  formatresults() Line 653  formatresults()
653            
654  }  }
655    
 show_help()  
 {  
     cat - << EOF  
 $0 [-help] [-quick] [-verbose] dir1 [dir2] [...]  
   
  -help|-h      Show this help message  
  -quiet     Reduce the amount of output  
  -verbose   Produce copious amounts of output  
  -debug     Produce even more output which will mean nothing to most  
  -force     Do "make CLEAN" before compiling. This forces a complete rebuild.  
  -clean     Do "make CLEAN" after compiling and testing.  
  -cleanup   Aggresively removes all model output, executables and object files  
             and then exits. Use with care.  
   
 Normal usage:  
  $0 *       Configure, compile, run and analyze in all experiment directories  
 EOF  
 }  
   
656  scandirs()  scandirs()
657  {  {
658      if [ $# -eq 1 ]; then      if [ $# -eq 1 ]; then
# Line 701  BASH= Line 692  BASH=
692  OPTFILE=NONE  OPTFILE=NONE
693  ADDRESSES=  ADDRESSES=
694  TESTDIRS=  TESTDIRS=
695    SKIPDIRS=
696  MPACKDIR="../tools/mpack-1.6"  MPACKDIR="../tools/mpack-1.6"
697  HAVE_MPACK=  HAVE_MPACK=
698  MPACK="$MPACKDIR/mpack"  MPACK="$MPACKDIR/mpack"
# Line 756  for ac_option ; do Line 748  for ac_option ; do
748          -tdir=* | --tdir=*)          -tdir=* | --tdir=*)
749              TESTDIRS=$ac_optarg ;;              TESTDIRS=$ac_optarg ;;
750    
751            -skipdir | --skipdir | -skd | --skd)
752                ac_prev=SKIPDIRS ;;
753            -skipdir=* | --skipdir=*)
754                SKIPDIRS=$ac_optarg ;;
755    
756          -bash | --bash | -b | --b)          -bash | --bash | -b | --b)
757              ac_prev=BASH ;;              ac_prev=BASH ;;
758          -bash=* | --bash=*)          -bash=* | --bash=*)
# Line 836  fi Line 833  fi
833    
834  if test "x$TESTDIRS" = x ; then  if test "x$TESTDIRS" = x ; then
835      if test "x$ADM" = xt ; then      if test "x$ADM" = xt ; then
836          TESTDIRS=`scandirs results_ad`          LIST=`scandirs results_ad`
837      else      else
838          TESTDIRS=`scandirs results`          LIST=`scandirs results`
839      fi      fi
840    else
841        #- expand group of experiments:
842        LIST=" "
843        for xx in $TESTDIRS
844        do
845          case $xx in
846            'basic') LIST=${LIST}" aim.5l_cs hs94.128x64x5 ideal_2D_oce"
847                     LIST=${LIST}" lab_sea tutorial_baroclinic_gyre"
848                     LIST=${LIST}" tutorial_global_oce_latlon tutorial_plume_on_slope"
849                    ;;
850            'tutorials')
851                     LIST=${LIST}" "`ls | grep 'tutorial_'` ;;
852            *)       LIST=${LIST}" "$xx ;;
853          esac
854        done
855  fi  fi
856    #echo 'LIST='${LIST}'<'
857    #- skip dirs, remove duplicate and non-directory:
858    TESTDIRS=" "
859    count=0
860    for xx in $LIST
861    do
862        yy=`echo $SKIPDIRS | grep -c $xx`
863        if test $yy = 0 ; then
864            if test -d $xx ; then
865                yy=`echo $TESTDIRS | grep -c $xx`
866                if test $yy = 0 ; then TESTDIRS=${TESTDIRS}" "$xx ; fi
867            else count=1 ;
868                echo ""; echo -n " -- skip \"$xx\" (not a directory !)"
869            fi
870        else
871            if test $count = 1 ; then echo -n ", \"$xx\""
872            else count=1 ; echo "" ;  echo -n " skip: \"$xx\""
873            fi
874        fi
875    done
876    if test $count = 1 ; then echo "" ; echo -n " ... " ; fi
877    #echo 'TESTDIRS='${TESTDIRS}'<'
878    
879  if test "x$OPTFILE" = xNONE -a "x$MITGCM_OF" != x ; then  if test "x$OPTFILE" = xNONE -a "x$MITGCM_OF" != x ; then
880      OPTFILE=$MITGCM_OF      OPTFILE=$MITGCM_OF
# Line 854  else Line 888  else
888      OUTPUTFILE="output.txt"      OUTPUTFILE="output.txt"
889  fi  fi
890    
 if test "x$ADM" = xt -a "x$COMMAND" = x ; then  
     COMMAND="./$EXECUTABLE > $OUTPUTFILE"  
 fi  
   
891  if test "x$COMMAND" = x ; then  if test "x$COMMAND" = x ; then
892      COMMAND="./$EXECUTABLE > $OUTPUTFILE"      COMMAND="./$EXECUTABLE > $OUTPUTFILE"
893  fi  fi
894    if test "x$MPI" = xt ; then
895        OUTPUTFILE="STDOUT.0000"
896    fi
897    
898  #echo "OK"  #echo "OK"
899  echo "OK (COMMAND= $COMMAND )"  echo "OK (COMMAND= $COMMAND )"
# Line 1034  for dir in $TESTDIRS ; do Line 1067  for dir in $TESTDIRS ; do
1067          #echo "ex_run_dirs='$ex_run_dirs'"          #echo "ex_run_dirs='$ex_run_dirs'"
1068          for exd in $ex_run_dirs ; do          for exd in $ex_run_dirs ; do
1069              name=`echo $exd | sed -e 's/input.//g'`              name=`echo $exd | sed -e 's/input.//g'`
1070              outf="$dir/results/output.txt.$name"              outf="$dir/results/output.$name.txt"
1071              if test -f $outf -a -r $outf ; then              if test -f $outf -a -r $outf ; then
1072                  if test "x$MULTI_THREAD" = "xt" ; then                  if test "x$MULTI_THREAD" = "xt" ; then
1073                      if test -r $dir"/"$exd"/eedata.mth" ; then                      if test -r $dir"/"$exd"/eedata.mth" ; then
# Line 1077  for dir in $TESTDIRS ; do Line 1110  for dir in $TESTDIRS ; do
1110              && makemodel $dir/$builddir && make=Y \              && makemodel $dir/$builddir && make=Y \
1111              && linkdata $dir/$rundir $input_dirs \              && linkdata $dir/$rundir $input_dirs \
1112              && runmodel $dir/$rundir && run=Y \              && runmodel $dir/$rundir && run=Y \
1113              && results=`testoutput $dir $rundir`              && results=`testoutput $dir $rundir "txt"`
1114      fi      fi
1115            
1116      echo      echo
# Line 1102  for dir in $TESTDIRS ; do Line 1135  for dir in $TESTDIRS ; do
1135              run_clean $dir/tr_run.$ex              run_clean $dir/tr_run.$ex
1136              linkdata $dir/tr_run.$ex input.$ex input              linkdata $dir/tr_run.$ex input.$ex input
1137              runmodel $dir/tr_run.$ex && run=Y \              runmodel $dir/tr_run.$ex && run=Y \
1138                  && results=`testoutput $dir tr_run.$ex "."$ex`                  && results=`testoutput $dir tr_run.$ex ${ex}".txt"`
1139              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}`
1140              fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`              fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`
1141              fres="$fres.$ex"              fres="$fres.$ex"

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

  ViewVC Help
Powered by ViewVC 1.1.22