/[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 by edhill, Tue Sep 16 18:16:03 2003 UTC revision 1.9.2.5 by edhill, Fri Oct 3 16:03:00 2003 UTC
# Line 22  usage() Line 22  usage()
22      echo "                             (DEF=\"make output.txt\")"      echo "                             (DEF=\"make output.txt\")"
23      echo "  (-m|-make)STRING         command to use for \"make\""      echo "  (-m|-make)STRING         command to use for \"make\""
24      echo "                             (DEF=\"make\")"      echo "                             (DEF=\"make\")"
25        echo "  (-quick|-q)              same as \"-nogenmake -noclean -nodepend\""
26        echo "  (-nogenmake|-ng)         skip the genmake stage"
27        echo "  (-noclean|-nc)           skip the \"make clean\" stage"
28        echo "  (-nodepend|-nd)          skip the \"make depend\" stage"
29      echo      echo
30      echo "and where STRING follows a whitespace-delimited format"      echo "and where STRING follows a whitespace-delimited format"
31      echo "such as:"      echo "such as:"
# Line 174  testoutput() Line 178  testoutput()
178  genmakemodel()  genmakemodel()
179  {  {
180      # genmakemodel directory      # genmakemodel directory
181      GENMAKE2="$BASH ../../../tools/genmake2"      if test "x$NOGENMAKE" = xt ; then
182      (          echo "genmake skipped!"
183          cd $1;      else
184          printf 'genmake ... ' 1>&2          GENMAKE2="$BASH ../../../tools/genmake2"
185          # ../../../tools/genmake -ieee -mods=../code > make.log 2>&1          (
186          $GENMAKE2  -ds -m $MAKE --mods=../code "--optfile="$OPTFILE > make.log 2>&1              cd $1;
187          RETVAL=$?              printf 'genmake ... ' 1>&2
188          for i in gm_state gm_optfile gm_local Makefile ; do              # ../../../tools/genmake -ieee -mods=../code > make.log 2>&1
189              if test -r $i ; then              $GENMAKE2  -ds -m $MAKE --mods=../code "--optfile="$OPTFILE > make.log 2>&1
190                  cp $i $CDIR              RETVAL=$?
191                for i in gm_state gm_optfile gm_local Makefile ; do
192                    if test -r $i ; then
193                        cp $i $CDIR
194                    fi
195                done
196                if test "x$RETVAL" != x0 ; then
197                    tail make.log
198                    echo "genmakemodel: genmake failed" 1>&2
199                    cp make.log $CDIR
200                    return 1
201                else
202                    echo "succesful" 1>&2
203              fi              fi
204          done          )
205          if test "x$RETVAL" != x0 ; then      fi
             tail make.log  
             echo "genmakemodel: genmake failed" 1>&2  
             cp make.log $CDIR  
             return 1  
         else  
             echo "succesful" 1>&2  
         fi  
     )  
206  }  }
207    
208  makeclean()  makeclean()
209  {  {
210      # makeclean directory      # makeclean directory
211      (      if test "x$NOCLEAN" = xt ; then
212          cd $1;          echo "make CLEAN skipped!"
213          if test -e output.txt ; then      else
214              rm -f output.txt          (
215          fi              cd $1;
216          printf 'make CLEAN ... ' 2>&1              if test -e output.txt ; then
217          if test -r Makefile ; then                  rm -f output.txt
             $MAKE CLEAN >> make.log 2>&1  
             RETVAL=$?  
             if test "x$RETVAL" != x0 ; then  
                 tail make.log  
                 echo "makeclean: \"make CLEAN\" failed" 1>&2  
                 cp make.log $CDIR"/make.log"  
                 return 1  
218              fi              fi
219          fi              printf 'make CLEAN ... ' 2>&1
220          echo succesful 1>&2              if test -r Makefile ; then
221          exit 0                  $MAKE CLEAN >> make.log 2>&1
222      )                  RETVAL=$?
223                    if test "x$RETVAL" != x0 ; then
224                        tail make.log
225                        echo "makeclean: \"make CLEAN\" failed" 1>&2
226                        cp make.log $CDIR"/make.log"
227                        return 1
228                    fi
229                fi
230                echo succesful 1>&2
231                exit 0
232            )
233        fi
234  }  }
235    
236  makedependmodel()  makedependmodel()
237  {  {
238      # makedependmodel directory      # makedependmodel directory
239      (      if test "x$NODEPEND" = xt ; then
240          cd $1;          echo "make depend skipped!"
241          printf 'make depend ... ' 1>&2      else
242          $MAKE depend >> make.log 2>&1          (
243          RETVAL=$?              cd $1;
244          if test "x$RETVAL" != x0 ; then              printf 'make depend ... ' 1>&2
245              tail make.log              $MAKE depend >> make.log 2>&1
246              echo "makedependmodel: make depend failed" 1>&2              RETVAL=$?
247              cp make.log $CDIR"/make.log"              if test "x$RETVAL" != x0 ; then
248              return 1                  tail make.log
249          else                  echo "makedependmodel: make depend failed" 1>&2
250              echo succesful 1>&2                  cp make.log $CDIR"/make.log"
251          fi                  return 1
252      )              else
253                    echo succesful 1>&2
254                fi
255            )
256        fi
257  }  }
258    
259  makemodel()  makemodel()
# Line 360  show_help() Line 376  show_help()
376  {  {
377      cat - << EOF      cat - << EOF
378  $0 [-help] [-quick] [-verbose] dir1 [dir2] [...]  $0 [-help] [-quick] [-verbose] dir1 [dir2] [...]
379   -help      Show this help message  
380   -quick     Skip "genmake" and "make depend" if the Makefile exists   -help|-h      Show this help message
381   -quiet     Reduce the amount of output   -quiet     Reduce the amount of output
382   -verbose   Produce copious amounts of output   -verbose   Produce copious amounts of output
383   -debug     Produce even more output which will mean nothing to most   -debug     Produce even more output which will mean nothing to most
# Line 399  verbose=1 Line 415  verbose=1
415  clean=0  clean=0
416  expts=''  expts=''
417  # ieee=1  # ieee=1
418  # quick=0  
419    CLEANUP=f
420    QUICK=f
421    NOGENMAKE=f
422    NOCLEAN=f
423    NODEPEND=f
424    
425  BASH=  BASH=
426  OPTFILES=  OPTFILES=
427  ADDRESSES=edhill@mitgcm.org  ADDRESSES=
428  TESTDIRS=  TESTDIRS=
429  MPACKDIR="../tools/mpack-1.6"  MPACKDIR="../tools/mpack-1.6"
430  MPACK="$MPACKDIR/mpack"  MPACK="$MPACKDIR/mpack"
# Line 460  for ac_option ; do Line 481  for ac_option ; do
481          -make=* | --make=*)          -make=* | --make=*)
482              MAKE=$ac_optarg ;;              MAKE=$ac_optarg ;;
483    
484            -clean | --clean)
485                CLEANUP=t ;;
486    
487            -quick | --quick | -q | --q)
488                QUICK=t ;;
489            -nogenmake | --nogenmake | -ng | --ng)
490                NOGENMAKE=t ;;
491            -noclean | --noclean | -nc | --nc)
492                NOCLEAN=t ;;
493            -nodepend | --nodepend | -nd | --nd)
494                NODEPEND=t ;;
495    
496          -mpi) MPI=t ;;          -mpi) MPI=t ;;
497          -verbose) verbose=2 ;;          -verbose) verbose=2 ;;
498          -debug) debug=1 ;;          -debug) debug=1 ;;
# Line 480  for ac_option ; do Line 513  for ac_option ; do
513            
514  done  done
515    
516    if test "x$QUICK" = xt ; then
517        NOGENMAKE=t
518        NOCLEAN=t
519        NODEPEND=t
520    fi
521    
522  if test "x$TESTDIRS" = x ; then  if test "x$TESTDIRS" = x ; then
523      TESTDIRS=`scandirs`      TESTDIRS=`scandirs`
524  fi  fi
525    
526    if test "x$OPTFILES" = x ; then
527        OPTFILES=$MITGCM_OF
528    fi
529    if test "x$OPTFILES" = x ; then
530        echo "Error: please specify an optfile using either the command-line or"
531        echo "  the MITGCM_OF environment variable.  Also, examples are located "
532        echo "  in \$ROOTDIR/tools/build_options"
533        exit 1
534    fi
535    
536  echo "OK"  echo "OK"
537    
538  #  create the FORTRAN comparison code  #  create the FORTRAN comparison code
# Line 537  for OPTFILE in $OPTFILES ; do Line 586  for OPTFILE in $OPTFILES ; do
586      #  ...and each test directory...      #  ...and each test directory...
587      for dir in $TESTDIRS ; do      for dir in $TESTDIRS ; do
588    
589            #  Cleanup only!
590            if test "x$CLEANUP" = xt ; then
591                if test -r $dir/build/Makefile ; then
592                    ( cd $dir/build ; make CLEAN )
593                fi
594                if test -r $dir/input/Makefile ; then
595                    ( cd $dir/input ; make CLEAN )
596                fi
597                continue
598            fi
599    
600          #  Verify that the testdir exists and contains previous          #  Verify that the testdir exists and contains previous
601          #  results in the correct location--or skip this directory!          #  results in the correct location--or skip this directory!
602          if test ! -r $dir"/results/output.txt" ; then          if test ! -r $dir"/results/output.txt" ; then
603              echo | tee -a $SUMMARY              echo
604              echo "can't read \"$dir/results/output.txt\" -- skipping $dir" \              echo "can't read \"$dir/results/output.txt\" -- skipping $dir"
605                  | tee -a $SUMMARY              echo
606              continue              continue
607          fi          fi
608    
         #  Is this an MPI run?  
         if test "x$MPI" = xt ; then  
             if test ! -r $dir"/code/CPP_EEOPTIONS.h_mpi" -o ! -r $dir"/code/SIZE.h_mpi" ; then  
                 echo | tee -a $SUMMARY  
                 echo "can't read \"$dir/code/CPP_EEOPTIONS.h_mpi\" or \"$dir/code/SIZE.h_mpi\"" \  
                     | tee -a $SUMMARY  
                 continue  
             else  
                 cp $dir"/code/CPP_EEOPTIONS.h_mpi" $dir"/code/CPP_EEOPTIONS.h"  
                 cp $dir"/code/SIZE.h_mpi" $dir"/code/SIZE.h"  
             fi  
         else  
             if test -r $dir"/code/CPP_EEOPTIONS.h_nompi" ; then  
                 cp $dir"/code/CPP_EEOPTIONS.h_nompi" $dir"/code/CPP_EEOPTIONS.h"  
             fi  
             if test -r $dir"/code/SIZE.h_nompi" ; then  
                 cp $dir"/code/SIZE.h_nompi" $dir"/code/SIZE.h"  
             fi  
         fi  
   
         #  Create an output dir for each OPTFILE/tdir combination  
         CDIR=$DRESULTS"/"$DRESULTS"_"$NDIR  
         mkdir $CDIR  
         CDIR=`pwd`"/$CDIR"  
   
         #  ...configue, make, run, and compare the output.  
609          echo "-------------------------------------------------------------------------------"          echo "-------------------------------------------------------------------------------"
610          echo          echo
611          echo "Experiment:  $dir"          echo "Experiment:  $dir"
612          echo          echo
613          unset genmake makedepend make run          unset genmake makedepend make run
614          results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'          results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'
615          ( cd $dir/input; rm -f *.{o,f,c,F} *.[f,F]90 work* output.txt Make* make.log; )  
616          if [ -r $dir/build ]; then          if [ -r $dir/build ]; then
617              seperatebuilddir=1              seperatebuilddir=1
618              builddir=build              builddir=build
# Line 590  for OPTFILE in $OPTFILES ; do Line 624  for OPTFILE in $OPTFILES ; do
624              rundir=input              rundir=input
625          fi          fi
626    
627          genmakemodel $dir/$builddir && genmake=Y \          CODE_DIR=$dir/code
628              && makeclean $dir/$builddir \          BUILD_DIR=$dir/$builddir
629              && makedependmodel $dir/$builddir && makedepend=Y \          MPI_FILES="CPP_EEOPTIONS.h_mpi SIZE.h_mpi"
630              && makemodel $dir/$builddir && make=Y \          NOMPI_FILES="CPP_EEOPTIONS.h_nompi SIZE.h_nompi"
631              && linkdata $seperatebuilddir $dir/$rundir \          #  Is this an MPI run?
632              && runmodel $dir/$builddir && run=Y \          if test "x$MPI" = xt ; then
633              && results=`testoutput $dir $rundir`              FILES=$MPI_FILES
634            else
635                FILES=$NOMPI_FILES
636            fi
637    
638            #  Check to see that we have the files
639            have_files=t
640            for i in $FILES ; do
641                if test ! -r $CODE_DIR/$i ; then
642                    echo "Warning: can't read file $CODE_DIR/$i" | tee -a $SUMMARY
643                    have_files=f
644                fi
645            done
646            if test "x$have_files" != xt -a "x$MPI" = xt ; then
647                echo "Skipping $dir due to lack of input files (see above warning)" \
648                    | tee -a $SUMMARY
649                continue
650            fi
651    
652            #  If we have the $FILES and they differ, copy the $FILES to $BUILD_DIR
653            if "x$have_files" = xt ; then
654                for i in $FILES ; do
655                    cmp $CODE_DIR/$i $BUILD_DIR/$i > /dev/null 2>&1
656                    RETVAL=$?
657                    if test "x$RETVAL" != x0 ; then
658                        cp $CODE_DIR/$i $BUILD_DIR/$i
659                    fi
660                done
661            fi
662    
663            #  Create an output dir for each OPTFILE/tdir combination
664            CDIR=$DRESULTS"/"$DRESULTS"_"$NDIR
665            mkdir $CDIR
666            CDIR=`pwd`"/$CDIR"
667    
668            if test "x$CLEANUP" = xt ; then
669                makeclean $dir/$builddir
670            else
671                genmakemodel $dir/$builddir && genmake=Y \
672                    && makeclean $dir/$builddir \
673                    && makedependmodel $dir/$builddir && makedepend=Y \
674                    && makemodel $dir/$builddir && make=Y \
675                    && linkdata $seperatebuilddir $dir/$rundir \
676                    && runmodel $dir/$builddir && run=Y \
677                    && results=`testoutput $dir $rundir`
678            fi
679    
680          echo          echo
681          formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \          formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \
682              ${run:-N} $results              ${run:-N} $results
# Line 618  for OPTFILE in $OPTFILES ; do Line 698  for OPTFILE in $OPTFILES ; do
698              gzip $NDIR".tar"              gzip $NDIR".tar"
699          )          )
700    
701          $MPACK -s MITgcm-test -m 1000000 $DRESULTS"/"$NDIR".tar.gz" $ADDRESSES          if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then
702          RETVAL=$?              echo "No mail sent"
         if test "x$RETVAL" != x0 ; then  
             echo "Warning: \"$MPACK\" failed -- please contact <edhill@mitgcm.org>"  
703          else          else
704              rm -f $DRESULTS"/"$NDIR".tar*"              $MPACK -s MITgcm-test -m 1000000 $DRESULTS"/"$NDIR".tar.gz" $ADDRESSES
705                RETVAL=$?
706                if test "x$RETVAL" != x0 ; then
707                    echo "Warning: \"$MPACK\" failed -- please contact <edhill@mitgcm.org>"
708                else
709                    rm -f $DRESULTS"/"$NDIR".tar*"
710                fi
711          fi          fi
712    
713          NDIR=$(( $NDIR + 1 ))          NDIR=$(( $NDIR + 1 ))

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.9.2.5

  ViewVC Help
Powered by ViewVC 1.1.22