/[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.11 by edhill, Fri Oct 10 03:29:44 2003 UTC revision 1.21 by edhill, Thu Nov 27 16:15:39 2003 UTC
# Line 1  Line 1 
1  #!/bin/bash  #! /usr/bin/env bash
2  #  #
3  #  $Header$  #  $Header$
4  #  $Name$  #  $Name$
# Line 13  usage() Line 13  usage()
13      echo "  (-help|-h)               print usage"      echo "  (-help|-h)               print usage"
14      echo "  (-mpi)                   use MPI input files"      echo "  (-mpi)                   use MPI input files"
15      echo "  (-ieee|-noieee)          if possible, use IEEE compiler flags"      echo "  (-ieee|-noieee)          if possible, use IEEE compiler flags"
16        echo "                             (DEF=\"noieee\")"
17      echo "  (-optfile=|-of=)STRING   list of optfiles to use"      echo "  (-optfile=|-of=)STRING   list of optfiles to use"
18      echo "  (-a|-addr)STRING         list of email recipients"      echo "  (-a|-addr) STRING        list of email recipients"
19      echo "                             (DEF=\"edhill@mitgcm.org\")"      echo "                             (DEF=\"edhill@mitgcm.org\")"
20      echo "  (-t|-tdir)STRING         list of test dirs to use"      echo "  (-t|-tdir) STRING        list of test dirs to use"
21      echo "                             (DEF=\"\" which builds all)"      echo "                             (DEF=\"\" which builds all)"
22      echo "  (-b|-bash)STRING         location of \"bash\" executable"      echo "  (-b|-bash) STRING        preferred location of a \"bash\" or"
23      echo "                             (DEF=\"\" for \"/bin/bash\")"      echo "                             Bourne-compatible \"sh\" shell"
24      echo "  (-command)STRING         command to run"      echo "                             (DEF=\"\" for \"bash\")"
25        echo "  (-command) STRING        command to run"
26      echo "                             (DEF=\"make output.txt\")"      echo "                             (DEF=\"make output.txt\")"
27      echo "  (-m|-make)STRING         command to use for \"make\""      echo "  (-m|-make) STRING        command to use for \"make\""
28      echo "                             (DEF=\"make\")"      echo "                             (DEF=\"make\")"
29      echo "  (-clean)                 *ONLY* run \"make CLEAN\""      echo "  (-clean)                 *ONLY* run \"make CLEAN\""
30      echo "  (-quick|-q)              same as \"-nogenmake -noclean -nodepend\""      echo "  (-quick|-q)              same as \"-nogenmake -noclean -nodepend\""
# Line 44  build_mpack() Line 46  build_mpack()
46      echo -n "building the mpack utility...  "      echo -n "building the mpack utility...  "
47      if test ! -x "$MPACKDIR/mpack" ; then      if test ! -x "$MPACKDIR/mpack" ; then
48          if test ! -d $MPACKDIR ; then          if test ! -d $MPACKDIR ; then
49                echo
50              echo "Error: can't find \"$MPACKDIR\""              echo "Error: can't find \"$MPACKDIR\""
51              echo "  are you sure this program is being run in the correct "              echo "  are you sure this program is being run in the correct "
52              echo "  (that is, \"MITGCM_ROOT\verification\") directory?"              echo "  (that is, \"MITGCM_ROOT\verification\") directory?"
53              exit 1              echo
54                HAVE_MPACK=f
55          fi          fi
56          echo -n "building mpack...  "          echo -n "building mpack...  "
57          ( cd $MPACKDIR && ./configure && $MAKE ) > build_mpack.out 2>&1          ( cd $MPACKDIR && ./configure && $MAKE ) > build_mpack.out 2>&1
# Line 55  build_mpack() Line 59  build_mpack()
59          if test "x$RETVAL" != x0 ; then          if test "x$RETVAL" != x0 ; then
60              echo              echo
61              echo "Error building the mpack tools at: $MPACK_DIR"              echo "Error building the mpack tools at: $MPACK_DIR"
62              exit 1              echo
63                HAVE_MPACK=f
64            else
65                HAVE_MPACK=t
66          fi          fi
67        else
68            HAVE_MPACK=t
69      fi      fi
70      echo "OK"      echo "OK"
71  }  }
# Line 81  testoutput_for_prop() Line 90  testoutput_for_prop()
90          echo testoutput_for_prop: grep "$2" $1/$4/output.txt 1>&2          echo testoutput_for_prop: grep "$2" $1/$4/output.txt 1>&2
91      fi      fi
92      if [ -r $1/$4/output.txt ]; then      if [ -r $1/$4/output.txt ]; then
93          grep "$2" $1/$4/output.txt | sed 's/.*=//' | nl > tmp1.txt          grep "$2" $1/$4/output.txt | sed 's/.*=//' | cat -n > tmp1.txt
94          lncnt=`wc -l tmp1.txt | awk '{print $1}' `          lncnt=`wc -l tmp1.txt | awk '{print $1}' `
95          if [ $lncnt -lt 3 ]; then          if [ $lncnt -lt 3 ]; then
96              if [ $verbose -gt 0 ]; then              if [ $verbose -gt 0 ]; then
# Line 96  testoutput_for_prop() Line 105  testoutput_for_prop()
105      if [ $debug -gt 0 ]; then      if [ $debug -gt 0 ]; then
106          echo testoutput_for_prop: grep "$2" $1/results/output.txt 1>&2          echo testoutput_for_prop: grep "$2" $1/results/output.txt 1>&2
107      fi      fi
108      grep "$2" $1/results/output.txt | sed 's/.*=//' | nl > tmp2.txt      grep "$2" $1/results/output.txt | sed 's/.*=//' | cat -n > tmp2.txt
109      lncnt=`wc -l tmp2.txt | awk '{print $1}' `      lncnt=`wc -l tmp2.txt | awk '{print $1}' `
110      if [ $lncnt -lt 3 ]; then      if [ $lncnt -lt 3 ]; then
111          if [ $verbose -gt 0 ]; then          if [ $verbose -gt 0 ]; then
# Line 156  testoutput() Line 165  testoutput()
165      if [ $debug -gt 0 ]; then      if [ $debug -gt 0 ]; then
166          echo testoutput: cg2dres=$cg2dres 1>&2          echo testoutput: cg2dres=$cg2dres 1>&2
167      fi      fi
       
168      testoutput_for_prop $1 "dynstat_theta_min" "theta minimum" $2; tmin=$?      testoutput_for_prop $1 "dynstat_theta_min" "theta minimum" $2; tmin=$?
169      testoutput_for_prop $1 "dynstat_theta_max" "theta maximum" $2; tmax=$?      testoutput_for_prop $1 "dynstat_theta_max" "theta maximum" $2; tmax=$?
170      testoutput_for_prop $1 "dynstat_theta_mean" "theta mean" $2; tmean=$?      testoutput_for_prop $1 "dynstat_theta_mean" "theta mean" $2; tmean=$?
# Line 190  genmakemodel() Line 198  genmakemodel()
198              command="$GENMAKE2  -ds -m $MAKE --mods=../code"              command="$GENMAKE2  -ds -m $MAKE --mods=../code"
199              if test "x$OPTFILE" != xNONE ; then              if test "x$OPTFILE" != xNONE ; then
200                  command="$command --optfile=$OPTFILE"                  command="$command --optfile=$OPTFILE"
                 # echo "  command=\"$command\""  
201              fi              fi
202              if test "x$IEEE" != x ; then              if test "x$IEEE" != x ; then
203                  command="$command -ieee"                  command="$command -ieee"
204              fi              fi
             # echo "command: \"$command\""  
205              printf 'genmake ... ' 1>&2              printf 'genmake ... ' 1>&2
206              $command > make.log 2>&1              $command > make.log 2>&1
207              RETVAL=$?              RETVAL=$?
208              for i in genmake_state genmake_optfile genmake_local Makefile ; do              cp Makefile $CDIR
                 if test -r $i ; then  
                     cp $i $CDIR  
                 fi  
             done  
209              if test "x$RETVAL" != x0 ; then              if test "x$RETVAL" != x0 ; then
210                  tail make.log                  tail make.log
211                  echo "genmakemodel: genmake failed" 1>&2                  echo "genmakemodel: genmake failed" 1>&2
212                  cp make.log $CDIR                  cp genmake_* make.log $CDIR
213                  return 1                  return 1
214              else              else
215                  echo "succesful" 1>&2                  echo "successful" 1>&2
216              fi              fi
217          )          )
218      fi      fi
# Line 238  makeclean() Line 240  makeclean()
240                      return 1                      return 1
241                  fi                  fi
242              fi              fi
243              echo succesful 1>&2              echo successful 1>&2
244              exit 0              exit 0
245          )          )
246      fi      fi
# Line 261  makedependmodel() Line 263  makedependmodel()
263                  cp make.log $CDIR"/make.log"                  cp make.log $CDIR"/make.log"
264                  return 1                  return 1
265              else              else
266                  echo succesful 1>&2                  echo successful 1>&2
267              fi              fi
268          )          )
269      fi      fi
# Line 282  makemodel() Line 284  makemodel()
284                  cp make.log $CDIR"/make.log"                  cp make.log $CDIR"/make.log"
285                  return 1                  return 1
286              else              else
287                  echo succesful 1>&2                  echo successful 1>&2
288              fi              fi
289          fi          fi
290      )      )
# Line 293  linkdata() Line 295  linkdata()
295      # linkdata flag      # linkdata flag
296      #      #
297      # symbolically link data files to run directory      # symbolically link data files to run directory
298      if [ $1 -ne 0 ]; then      if test "x$1" = x1 ; then
299          ( cd $2 ;  ln -sf ../input/* . )          (
300                cd $2
301                files=`( cd ../input ; ls -1 | grep -v CVS )`
302                for i in $files ; do
303                    if test ! -d "../input/"$i ; then
304                        ln -sf "../input/"$i $i
305                    fi
306                done
307            )
308      fi      fi
309  }  }
310    
# Line 306  runmodel() Line 316  runmodel()
316      #  (where "$COMMAND" is relative to "directory")      #  (where "$COMMAND" is relative to "directory")
317      (      (
318          cd $1          cd $1
319          printf 'runmodel: ' 1>&2          printf 'runmodel ... ' 1>&2
320          # make output.txt          # make output.txt
321          $COMMAND          $COMMAND >> run.log 2>&1
322          RETVAL=$?          RETVAL=$?
323          if test "x$RETVAL" = x0 ; then          if test "x$RETVAL" = x0 ; then
324                echo successful 1>&2
325              cp output.txt $CDIR"/output.txt"              cp output.txt $CDIR"/output.txt"
326              return 0              return 0
327          else          else
328                tail run.log
329                echo failed 1>&2
330                cp run.log $CDIR"/run.log"
331              return 1              return 1
332          fi          fi
333      )      )
# Line 349  c         print *,int(log10(diff)),diff Line 363  c         print *,int(log10(diff)),diff
363        end        end
364  EOFA  EOFA
365    
366      f77 tmp_cmpnum.f      f77 -o a.out tmp_cmpnum.f
367      if [ -x ./a.out ]; then      if [ -x ./a.out ]; then
368          echo "OK"          echo "OK"
369          return 0          return 0
370      else      else
371          echo          echo
372          echo "createcodelet: failed to compile codelet"          echo "ERROR: failed to compile comparison code"
373          exit 1          exit 1
374      fi      fi
375  }  }
# Line 415  scandirs() Line 429  scandirs()
429    
430    
431  ###############################################################################  ###############################################################################
 ###############################################################################  
 ###############################################################################  
432    
433    
434  #  Default properties  #  Default properties
# Line 443  OPTFILE=NONE Line 455  OPTFILE=NONE
455  ADDRESSES=  ADDRESSES=
456  TESTDIRS=  TESTDIRS=
457  MPACKDIR="../tools/mpack-1.6"  MPACKDIR="../tools/mpack-1.6"
458    HAVE_MPACK=
459  MPACK="$MPACKDIR/mpack"  MPACK="$MPACKDIR/mpack"
460  COMMAND="make output.txt"  COMMAND="make output.txt"
461  MAKE=make  MAKE=make
# Line 509  for ac_option ; do Line 522  for ac_option ; do
522          -nodepend | --nodepend | -nd | --nd)          -nodepend | --nodepend | -nd | --nd)
523              NODEPEND=t ;;              NODEPEND=t ;;
524    
525          -mpi) MPI=true ;;          -mpi) MPI=t ;;
526    
527          -ieee) IEEE=true ;;          -ieee) IEEE=true ;;
528          -noieee) IEEE= ;;          -noieee) IEEE= ;;
# Line 568  done Line 581  done
581  mkdir $DRESULTS  mkdir $DRESULTS
582  RETVAL=$?  RETVAL=$?
583  if test "x$RETVAL" != x0 ; then  if test "x$RETVAL" != x0 ; then
584      echo "Error: can't create results directory \"./$DRESULTS\""      echo "ERROR: Can't create results directory \"./$DRESULTS\""
585      exit 1      exit 1
586  fi  fi
587  SUMMARY="$DRESULTS/summary.txt"  SUMMARY="$DRESULTS/summary.txt"
588  date > $SUMMARY  echo -n "Start time:  " >> $SUMMARY
589  cat << EOF >> $SUMMARY  start_date=`date`
590                  T           S           U           V  echo $start_date > $SUMMARY
 G D M    c        m  s        m  s        m  s        m  s  
 E p a R  g  m  m  e  .  m  m  e  .  m  m  e  .  m  m  e  .  
 N n k u  2  i  a  a  d  i  a  a  d  i  a  a  d  i  a  a  d  
 2 d e n  d  n  x  n  .  n  x  n  .  n  x  n  .  n  x  n  .  
   
 EOF  
   
 NDIR=0  
591    
592  of_path=  of_path=
593  if test "x$OPTFILE" != xNONE ; then  if test "x$OPTFILE" != xNONE ; then
# Line 596  if test "x$OPTFILE" != xNONE ; then Line 601  if test "x$OPTFILE" != xNONE ; then
601          fi          fi
602          file=${OPTFILE##*/}          file=${OPTFILE##*/}
603          OPTFILE=$of_path/$file          OPTFILE=$of_path/$file
604            cp $OPTFILE $DRESULTS
605            echo >> $SUMMARY
606            echo "  OPTFILE=$OPTFILE" >> $SUMMARY
607      else      else
608          echo          echo | tee $SUMMARY
609          echo "WARNING: can't read OPTFILE=\"$OPTFILE\" but will try to use it..."          echo "ERROR: can't read OPTFILE=\"$OPTFILE\"" | tee $SUMMARY
610            exit 1
611      fi      fi
612    else
613        echo >> $SUMMARY
614        echo "No \"OPTFILE\" was explicitly specified by testreport," >> $SUMMARY
615        echo "   so the genmake default will be used." >> $SUMMARY
616  fi  fi
617  echo  echo
 echo "OPTFILE=$OPTFILE" >> $SUMMARY  
618  echo >> $SUMMARY  echo >> $SUMMARY
619    cat << EOF | tee -a $SUMMARY
620                    T           S           U           V
621    G D M    c        m  s        m  s        m  s        m  s
622    E p a R  g  m  m  e  .  m  m  e  .  m  m  e  .  m  m  e  .
623    N n k u  2  i  a  a  d  i  a  a  d  i  a  a  d  i  a  a  d
624    2 d e n  d  n  x  n  .  n  x  n  .  n  x  n  .  n  x  n  .
625    
626    EOF
627    
628  #  ...and each test directory...  #  ...and each test directory...
629  for dir in $TESTDIRS ; do  for dir in $TESTDIRS ; do
# Line 633  for dir in $TESTDIRS ; do Line 653  for dir in $TESTDIRS ; do
653      unset genmake makedepend make run      unset genmake makedepend make run
654      results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'      results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'
655    
656      if [ -r $dir/build ]; then      builddir="input"
657          seperatebuilddir=1      rundir="input"
658          builddir=build      use_seperate_build=0
659          rundir=build      if test -d $dir/build -a -r $dir/build ; then
660          ( cd $dir/build; ln -sf ../input/* . )          builddir="build"
661      else          rundir="build"
662          seperatebuilddir=0          use_seperate_build=1
663          builddir=input          linkdata $use_seperate_build $dir/$rundir
         rundir=input  
664      fi      fi
665            
666      CODE_DIR=$dir/code      CODE_DIR=$dir/code
# Line 685  for dir in $TESTDIRS ; do Line 704  for dir in $TESTDIRS ; do
704      fi      fi
705            
706      #  Create an output dir for each OPTFILE/tdir combination      #  Create an output dir for each OPTFILE/tdir combination
707      CDIR=$DRESULTS"/"$DRESULTS"_"$NDIR      rel_CDIR=$DRESULTS"/"$dir
708      mkdir $CDIR      mkdir $rel_CDIR
709      CDIR=`pwd`"/$CDIR"      CDIR=`pwd`"/$rel_CDIR"
710            
711      if test "x$CLEANUP" = xt ; then      if test "x$CLEANUP" = xt ; then
712          makeclean $dir/$builddir          makeclean $dir/$builddir
# Line 696  for dir in $TESTDIRS ; do Line 715  for dir in $TESTDIRS ; do
715              && makeclean $dir/$builddir \              && makeclean $dir/$builddir \
716              && makedependmodel $dir/$builddir && makedepend=Y \              && makedependmodel $dir/$builddir && makedepend=Y \
717              && makemodel $dir/$builddir && make=Y \              && makemodel $dir/$builddir && make=Y \
718              && linkdata $seperatebuilddir $dir/$rundir \              && linkdata $use_seperate_build $dir/$rundir \
719              && runmodel $dir/$builddir && run=Y \              && runmodel $dir/$rundir && run=Y \
720              && results=`testoutput $dir $rundir`              && results=`testoutput $dir $rundir`
721      fi      fi
722            
723      echo      echo
724      formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \      fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`
         ${run:-N} $results  
725      echo      echo
726      formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \      echo "$fres" >> $SUMMARY
727          ${run:-N} $results >> $SUMMARY      echo "fresults='$fres'" > $CDIR"/summary.txt"
     echo "fresults='" > $CDIR"/summary.txt"  
     formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \  
         ${run:-N} $results >> $CDIR"/summary.txt"  
     echo "'" >> $CDIR"/summary.txt"  
728      echo "MACH='$MACH'" >> $CDIR"/summary.txt"      echo "MACH='$MACH'" >> $CDIR"/summary.txt"
729      echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"      echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"
730      echo "DATE='$DATE'" >> $CDIR"/summary.txt"      echo "DATE='$DATE'" >> $CDIR"/summary.txt"
731      echo "tdir='$dir'" >> $CDIR"/summary.txt"      echo "tdir='$dir'" >> $CDIR"/summary.txt"
732            
733      (      echo "-------------------------------------------------------------------------------"
         cd $DRESULTS  
         tar -cf $NDIR".tar" $DRESULTS"_"$NDIR > /dev/null 2>&1  
         gzip $NDIR".tar"  
     )  
734            
735      if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then  done
736          echo "No mail sent"  
737      else  echo -n "Start time:  " >> $SUMMARY
738          $MPACK -s MITgcm-test -m 1000000 $DRESULTS"/"$NDIR".tar.gz" $ADDRESSES  echo $start_date >> $SUMMARY
739    echo -n "End time:    " >> $SUMMARY
740    date >> $SUMMARY
741    
742    #  If addresses were supplied and mpack built successfully, then try
743    #  to send email using mpack.
744    if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then
745        echo "No results email was sent."
746    else
747        if test "x$HAVE_MPACK" = xt ; then
748            tar -cf $DRESULTS".tar" $DRESULTS > /dev/null 2>&1 \
749                && gzip $DRESULTS".tar" \
750                && $MPACK -s MITgcm-test -m 1500000 $DRESULTS".tar.gz" $ADDRESSES
751          RETVAL=$?          RETVAL=$?
752          if test "x$RETVAL" != x0 ; then          if test "x$RETVAL" != x0 ; then
753              echo "Warning: \"$MPACK\" failed -- please contact <edhill@mitgcm.org>"              echo
754                echo "Warning: The tar, gzip, & mpack step failed.  Please send email"
755                echo "  to <MITgcm-support@mitgcm.org> for help.  You may copy the "
756                echo "  summary of results from the directory \"$DRESULTS\"."
757                echo
758          else          else
759              rm -f $DRESULTS"/"$NDIR".tar*"              echo
760                echo "An email containing results was sent to the following addresses:"
761                echo "  \"$ADDRESSES\""
762                echo
763          fi          fi
764            test -f $DRESULTS".tar"  &&  rm -f $DRESULTS".tar"
765            test -f $DRESULTS".tar.gz"  &&  rm -f $DRESULTS".tar.gz"
766      fi      fi
767    fi
     echo "-------------------------------------------------------------------------------"  
       
     NDIR=$(( $NDIR + 1 ))  
       
 done  
768    
769  rm tmp_cmpnum.f a.out  rm tmp_cmpnum.f a.out
770    
771  cat $SUMMARY  if test "x$CLEANUP" != xt ; then
772        cat $SUMMARY
773        if test -e tr.out ; then
774            mv tr.out tr.out.old
775        fi
776        cat $SUMMARY > tr.out
777    fi
778    

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.21

  ViewVC Help
Powered by ViewVC 1.1.22