/[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.9.2.8 by edhill, Sat Oct 4 02:10:52 2003 UTC revision 1.20 by edhill, Wed Nov 26 15:04:42 2003 UTC
# Line 1  Line 1 
1  #!/bin/bash  #! /usr/bin/env bash
2  #  #
3  #  $Header$  #  $Header$
4    #  $Name$
5  #  #
6    
7  usage()  usage()
# Line 11  usage() Line 12  usage()
12      echo "where possible OPTIONS are:"      echo "where possible OPTIONS are:"
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"
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 42  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 53  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 79  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 94  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 154  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 185  genmakemodel() Line 195  genmakemodel()
195          GENMAKE2="$BASH ../../../tools/genmake2"          GENMAKE2="$BASH ../../../tools/genmake2"
196          (          (
197              cd $1;              cd $1;
             printf 'genmake ... ' 1>&2  
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"
201                  # echo "  command=\"$command\""                  # echo "  command=\"$command\""
202              fi              fi
203                if test "x$IEEE" != x ; then
204                    command="$command -ieee"
205                fi
206                # echo "command: \"$command\""
207                printf 'genmake ... ' 1>&2
208              $command > make.log 2>&1              $command > make.log 2>&1
209              RETVAL=$?              RETVAL=$?
210              for i in genmake_state genmake_optfile genmake_local Makefile ; do              for i in genmake_state genmake_optfile genmake_local Makefile ; do
# Line 204  genmakemodel() Line 218  genmakemodel()
218                  cp make.log $CDIR                  cp make.log $CDIR
219                  return 1                  return 1
220              else              else
221                  echo "succesful" 1>&2                  echo "successful" 1>&2
222              fi              fi
223          )          )
224      fi      fi
# Line 232  makeclean() Line 246  makeclean()
246                      return 1                      return 1
247                  fi                  fi
248              fi              fi
249              echo succesful 1>&2              echo successful 1>&2
250              exit 0              exit 0
251          )          )
252      fi      fi
# Line 255  makedependmodel() Line 269  makedependmodel()
269                  cp make.log $CDIR"/make.log"                  cp make.log $CDIR"/make.log"
270                  return 1                  return 1
271              else              else
272                  echo succesful 1>&2                  echo successful 1>&2
273              fi              fi
274          )          )
275      fi      fi
# Line 276  makemodel() Line 290  makemodel()
290                  cp make.log $CDIR"/make.log"                  cp make.log $CDIR"/make.log"
291                  return 1                  return 1
292              else              else
293                  echo succesful 1>&2                  echo successful 1>&2
294              fi              fi
295          fi          fi
296      )      )
# Line 287  linkdata() Line 301  linkdata()
301      # linkdata flag      # linkdata flag
302      #      #
303      # symbolically link data files to run directory      # symbolically link data files to run directory
304      if [ $1 -ne 0 ]; then      if test "x$1" = x1 ; then
305          ( cd $2 ;  ln -sf ../input/* . )          (
306                cd $2
307                files=`( cd ../input ; ls -1 | grep -v CVS )`
308                for i in $files ; do
309                    if test ! -d "../input/"$i ; then
310                        ln -sf "../input/"$i $i
311                    fi
312                done
313            )
314      fi      fi
315  }  }
316    
# Line 300  runmodel() Line 322  runmodel()
322      #  (where "$COMMAND" is relative to "directory")      #  (where "$COMMAND" is relative to "directory")
323      (      (
324          cd $1          cd $1
325          printf 'runmodel: ' 1>&2          printf 'runmodel ... ' 1>&2
326          # make output.txt          # make output.txt
327          $COMMAND          $COMMAND >> run.log 2>&1
328          RETVAL=$?          RETVAL=$?
329          if test "x$RETVAL" = x0 ; then          if test "x$RETVAL" = x0 ; then
330                echo successful 1>&2
331              cp output.txt $CDIR"/output.txt"              cp output.txt $CDIR"/output.txt"
332              return 0              return 0
333          else          else
334                tail run.log
335                echo failed 1>&2
336                cp run.log $CDIR"/run.log"
337              return 1              return 1
338          fi          fi
339      )      )
# Line 388  $0 [-help] [-quick] [-verbose] dir1 [dir Line 414  $0 [-help] [-quick] [-verbose] dir1 [dir
414   -debug     Produce even more output which will mean nothing to most   -debug     Produce even more output which will mean nothing to most
415   -force     Do "make CLEAN" before compiling. This forces a complete rebuild.   -force     Do "make CLEAN" before compiling. This forces a complete rebuild.
416   -clean     Do "make CLEAN" after compiling and testing.   -clean     Do "make CLEAN" after compiling and testing.
  -noieee    By default, $0 uses the -ieee option for genmake. This turns it off.  
417   -cleanup   Aggresively removes all model output, executables and object files   -cleanup   Aggresively removes all model output, executables and object files
418              and then exits. Use with care.              and then exits. Use with care.
419    
# Line 421  clean=0 Line 446  clean=0
446  expts=''  expts=''
447  # ieee=1  # ieee=1
448    
449    IEEE=
450    if test "x$MITGCM_IEEE" != x ; then
451        IEEE=$MITGCM_IEEE
452    fi
453    
454    
455  CLEANUP=f  CLEANUP=f
456  QUICK=f  QUICK=f
457  NOGENMAKE=f  NOGENMAKE=f
# Line 432  OPTFILE=NONE Line 463  OPTFILE=NONE
463  ADDRESSES=  ADDRESSES=
464  TESTDIRS=  TESTDIRS=
465  MPACKDIR="../tools/mpack-1.6"  MPACKDIR="../tools/mpack-1.6"
466    HAVE_MPACK=
467  MPACK="$MPACKDIR/mpack"  MPACK="$MPACKDIR/mpack"
468  COMMAND="make output.txt"  COMMAND="make output.txt"
469  MAKE=make  MAKE=make
# Line 499  for ac_option ; do Line 531  for ac_option ; do
531              NODEPEND=t ;;              NODEPEND=t ;;
532    
533          -mpi) MPI=t ;;          -mpi) MPI=t ;;
534    
535            -ieee) IEEE=true ;;
536            -noieee) IEEE= ;;
537    
538          -verbose) verbose=2 ;;          -verbose) verbose=2 ;;
539          -debug) debug=1 ;;          -debug) debug=1 ;;
540          -quiet) verbose=0 ;;          -quiet) verbose=0 ;;
# Line 553  done Line 589  done
589  mkdir $DRESULTS  mkdir $DRESULTS
590  RETVAL=$?  RETVAL=$?
591  if test "x$RETVAL" != x0 ; then  if test "x$RETVAL" != x0 ; then
592      echo "Error: can't create results directory \"./$DRESULTS\""      echo "ERROR: Can't create results directory \"./$DRESULTS\""
593      exit 1      exit 1
594  fi  fi
595  SUMMARY="$DRESULTS/summary.txt"  SUMMARY="$DRESULTS/summary.txt"
596  date > $SUMMARY  echo -n "Start time:  " >> $SUMMARY
597  cat << EOF >> $SUMMARY  start_date=`date`
598    echo $start_date > $SUMMARY
599    cat << EOF | tee -a $SUMMARY
600                  T           S           U           V                  T           S           U           V
601  G D M    c        m  s        m  s        m  s        m  s  G D M    c        m  s        m  s        m  s        m  s
602  E p a R  g  m  m  e  .  m  m  e  .  m  m  e  .  m  m  e  .  E p a R  g  m  m  e  .  m  m  e  .  m  m  e  .  m  m  e  .
# Line 569  EOF Line 607  EOF
607    
608  NDIR=0  NDIR=0
609    
610    of_path=
611  if test "x$OPTFILE" != xNONE ; then  if test "x$OPTFILE" != xNONE ; then
612      if test -r $OPTFILE ; then      if test -r $OPTFILE ; then
613          OPTFILE=`pwd`"/$OPTFILE"          # get the path
614            path=${OPTFILE%/*}
615            if test "x$path" = x ; then
616                of_path=`pwd`
617            else
618                of_path=`( cd $path > /dev/null 2>&1 ; pwd )`
619            fi
620            file=${OPTFILE##*/}
621            OPTFILE=$of_path/$file
622        else
623            echo
624            echo "WARNING: can't read OPTFILE=\"$OPTFILE\" but will try to use it..."
625      fi      fi
626  fi  fi
627  echo  echo
# Line 606  for dir in $TESTDIRS ; do Line 656  for dir in $TESTDIRS ; do
656      unset genmake makedepend make run      unset genmake makedepend make run
657      results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'      results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'
658    
659      if [ -r $dir/build ]; then      builddir="input"
660          seperatebuilddir=1      rundir="input"
661          builddir=build      use_seperate_build=0
662          rundir=build      if test -d $dir/build -a -r $dir/build ; then
663          ( cd $dir/build; ln -sf ../input/* . )          builddir="build"
664      else          rundir="build"
665          seperatebuilddir=0          use_seperate_build=1
666          builddir=input          linkdata $use_seperate_build $dir/$rundir
         rundir=input  
667      fi      fi
668            
669      CODE_DIR=$dir/code      CODE_DIR=$dir/code
# Line 625  for dir in $TESTDIRS ; do Line 674  for dir in $TESTDIRS ; do
674      #  Is this an MPI run?      #  Is this an MPI run?
675      if test "x$MPI" = xt ; then      if test "x$MPI" = xt ; then
676          FILES=$MPI_FILES          FILES=$MPI_FILES
677            endings="_mpi"
678      else      else
679          FILES=$NOMPI_FILES          FILES=$NOMPI_FILES
680            endings="_nompi"
681      fi      fi
682            
683      #  Check to see that we have the files      #  Check to see that we have the files
# Line 645  for dir in $TESTDIRS ; do Line 696  for dir in $TESTDIRS ; do
696      #  If we have the $FILES and they differ, copy the $FILES to $BUILD_DIR      #  If we have the $FILES and they differ, copy the $FILES to $BUILD_DIR
697      if test "x$have_files" = xt ; then      if test "x$have_files" = xt ; then
698          for i in $FILES ; do          for i in $FILES ; do
699              cmp $CODE_DIR/$i $BUILD_DIR/$i > /dev/null 2>&1              sstr="s|$endings||"
700                name=`echo $i | sed -e $sstr `
701                cmp $CODE_DIR/$i $BUILD_DIR/$name > /dev/null 2>&1
702              RETVAL=$?              RETVAL=$?
703              if test "x$RETVAL" != x0 ; then              if test "x$RETVAL" != x0 ; then
704                  cp $CODE_DIR/$i $BUILD_DIR/$i                  cp $CODE_DIR/$i $BUILD_DIR/$name
705              fi              fi
706          done          done
707      fi      fi
708            
709      #  Create an output dir for each OPTFILE/tdir combination      #  Create an output dir for each OPTFILE/tdir combination
710      CDIR=$DRESULTS"/"$DRESULTS"_"$NDIR      rel_CDIR=$DRESULTS"/"$dir
711      mkdir $CDIR      mkdir $rel_CDIR
712      CDIR=`pwd`"/$CDIR"      CDIR=`pwd`"/$rel_CDIR"
713            
714      if test "x$CLEANUP" = xt ; then      if test "x$CLEANUP" = xt ; then
715          makeclean $dir/$builddir          makeclean $dir/$builddir
# Line 665  for dir in $TESTDIRS ; do Line 718  for dir in $TESTDIRS ; do
718              && makeclean $dir/$builddir \              && makeclean $dir/$builddir \
719              && makedependmodel $dir/$builddir && makedepend=Y \              && makedependmodel $dir/$builddir && makedepend=Y \
720              && makemodel $dir/$builddir && make=Y \              && makemodel $dir/$builddir && make=Y \
721              && linkdata $seperatebuilddir $dir/$rundir \              && linkdata $use_seperate_build $dir/$rundir \
722              && runmodel $dir/$builddir && run=Y \              && runmodel $dir/$rundir && run=Y \
723              && results=`testoutput $dir $rundir`              && results=`testoutput $dir $rundir`
724      fi      fi
725            
# Line 685  for dir in $TESTDIRS ; do Line 738  for dir in $TESTDIRS ; do
738      echo "DATE='$DATE'" >> $CDIR"/summary.txt"      echo "DATE='$DATE'" >> $CDIR"/summary.txt"
739      echo "tdir='$dir'" >> $CDIR"/summary.txt"      echo "tdir='$dir'" >> $CDIR"/summary.txt"
740            
741      (      echo "-------------------------------------------------------------------------------"
         cd $DRESULTS  
         tar -cf $NDIR".tar" $DRESULTS"_"$NDIR > /dev/null 2>&1  
         gzip $NDIR".tar"  
     )  
742            
743      if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then      NDIR=$(( $NDIR + 1 ))
744          echo "No mail sent"      
745      else  done
746          $MPACK -s MITgcm-test -m 1000000 $DRESULTS"/"$NDIR".tar.gz" $ADDRESSES  
747    echo -n "Start time:  " >> $SUMMARY
748    echo $start_date >> $SUMMARY
749    echo -n "End time:    " >> $SUMMARY
750    date >> $SUMMARY
751    
752    #  If addresses were supplied and mpack built successfully, then try
753    #  to send email using mpack.
754    if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then
755        echo "No results email was sent."
756    else
757        if test "x$HAVE_MPACK" = xt ; then
758            tar -cf $DRESULTS".tar" $DRESULTS > /dev/null 2>&1 \
759                && gzip $DRESULTS".tar" \
760                && $MPACK -s MITgcm-test -m 1500000 $DRESULTS".tar.gz" $ADDRESSES
761          RETVAL=$?          RETVAL=$?
762          if test "x$RETVAL" != x0 ; then          if test "x$RETVAL" != x0 ; then
763              echo "Warning: \"$MPACK\" failed -- please contact <edhill@mitgcm.org>"              echo
764                echo "Warning: The tar, gzip, & mpack step failed.  Please send email"
765                echo "  to <MITgcm-support@mitgcm.org> for help.  You may copy the "
766                echo "  summary of results from the directory \"$DRESULTS\"."
767                echo
768          else          else
769              rm -f $DRESULTS"/"$NDIR".tar*"              echo
770                echo "An email containing results was sent to the following addresses:"
771                echo "  \"$ADDRESSES\""
772                echo
773          fi          fi
774            test -f $DRESULTS".tar"  &&  rm -f $DRESULTS".tar"
775            test -f $DRESULTS".tar.gz"  &&  rm -f $DRESULTS".tar.gz"
776      fi      fi
777    fi
     echo "-------------------------------------------------------------------------------"  
       
     NDIR=$(( $NDIR + 1 ))  
       
 done  
778    
779  rm tmp_cmpnum.f a.out  rm tmp_cmpnum.f a.out
780    
781  cat $SUMMARY  if test "x$CLEANUP" != xt ; then
782        cat $SUMMARY
783        if test -e tr.out ; then
784            mv tr.out tr.out.old
785        fi
786        cat $SUMMARY > tr.out
787    fi
788    

Legend:
Removed from v.1.9.2.8  
changed lines
  Added in v.1.20

  ViewVC Help
Powered by ViewVC 1.1.22