/[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.7 by edhill, Fri Oct 3 19:12:27 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              command="$GENMAKE2  -ds -m $MAKE --mods=../code"
189              if test -r $i ; then              if test "x$OPTFILE" != xNONE ; then
190                  cp $i $CDIR                  command="$command --optfile=$OPTFILE"
191                    # echo "  command=\"$command\""
192              fi              fi
193          done              $command > make.log 2>&1
194          if test "x$RETVAL" != x0 ; then              RETVAL=$?
195              tail make.log              for i in gm_state gm_optfile gm_local Makefile ; do
196              echo "genmakemodel: genmake failed" 1>&2                  if test -r $i ; then
197              cp make.log $CDIR                      cp $i $CDIR
198              return 1                  fi
199          else              done
200              echo "succesful" 1>&2              if test "x$RETVAL" != x0 ; then
201          fi                  tail make.log
202      )                  echo "genmakemodel: genmake failed" 1>&2
203                    cp make.log $CDIR
204                    return 1
205                else
206                    echo "succesful" 1>&2
207                fi
208            )
209        fi
210  }  }
211    
212  makeclean()  makeclean()
213  {  {
214      # makeclean directory      # makeclean directory
215      (      if test "x$NOCLEAN" = xt ; then
216          cd $1;          echo "make CLEAN skipped!"
217          if test -e output.txt ; then      else
218              rm -f output.txt          (
219          fi              cd $1;
220          printf 'make CLEAN ... ' 2>&1              if test -e output.txt ; then
221          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  
222              fi              fi
223          fi              printf 'make CLEAN ... ' 2>&1
224          echo succesful 1>&2              if test -r Makefile ; then
225          exit 0                  $MAKE CLEAN >> make.log 2>&1
226      )                  RETVAL=$?
227                    if test "x$RETVAL" != x0 ; then
228                        tail make.log
229                        echo "makeclean: \"make CLEAN\" failed" 1>&2
230                        cp make.log $CDIR"/make.log"
231                        return 1
232                    fi
233                fi
234                echo succesful 1>&2
235                exit 0
236            )
237        fi
238  }  }
239    
240  makedependmodel()  makedependmodel()
241  {  {
242      # makedependmodel directory      # makedependmodel directory
243      (      if test "x$NODEPEND" = xt ; then
244          cd $1;          echo "make depend skipped!"
245          printf 'make depend ... ' 1>&2      else
246          $MAKE depend >> make.log 2>&1          (
247          RETVAL=$?              cd $1;
248          if test "x$RETVAL" != x0 ; then              printf 'make depend ... ' 1>&2
249              tail make.log              $MAKE depend >> make.log 2>&1
250              echo "makedependmodel: make depend failed" 1>&2              RETVAL=$?
251              cp make.log $CDIR"/make.log"              if test "x$RETVAL" != x0 ; then
252              return 1                  tail make.log
253          else                  echo "makedependmodel: make depend failed" 1>&2
254              echo succesful 1>&2                  cp make.log $CDIR"/make.log"
255          fi                  return 1
256      )              else
257                    echo succesful 1>&2
258                fi
259            )
260        fi
261  }  }
262    
263  makemodel()  makemodel()
# Line 360  show_help() Line 380  show_help()
380  {  {
381      cat - << EOF      cat - << EOF
382  $0 [-help] [-quick] [-verbose] dir1 [dir2] [...]  $0 [-help] [-quick] [-verbose] dir1 [dir2] [...]
383   -help      Show this help message  
384   -quick     Skip "genmake" and "make depend" if the Makefile exists   -help|-h      Show this help message
385   -quiet     Reduce the amount of output   -quiet     Reduce the amount of output
386   -verbose   Produce copious amounts of output   -verbose   Produce copious amounts of output
387   -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 419  verbose=1
419  clean=0  clean=0
420  expts=''  expts=''
421  # ieee=1  # ieee=1
422  # quick=0  
423    CLEANUP=f
424    QUICK=f
425    NOGENMAKE=f
426    NOCLEAN=f
427    NODEPEND=f
428    
429  BASH=  BASH=
430  OPTFILES=  OPTFILE=NONE
431  ADDRESSES=edhill@mitgcm.org  ADDRESSES=
432  TESTDIRS=  TESTDIRS=
433  MPACKDIR="../tools/mpack-1.6"  MPACKDIR="../tools/mpack-1.6"
434  MPACK="$MPACKDIR/mpack"  MPACK="$MPACKDIR/mpack"
# Line 431  for ac_option ; do Line 456  for ac_option ; do
456              usage ;;              usage ;;
457                    
458          -optfile | --optfile | -of | --of)          -optfile | --optfile | -of | --of)
459              ac_prev=OPTFILES ;;              ac_prev=OPTFILE ;;
460          -optfile=* | --optfile=* | -of=* | --of=*)          -optfile=* | --optfile=* | -of=* | --of=*)
461              OPTFILES=$ac_optarg ;;              OPTFILE=$ac_optarg ;;
462                    
463          -addr | --addr | -a | --a)          -addr | --addr | -a | --a)
464              ac_prev=ADDRESSES ;;              ac_prev=ADDRESSES ;;
# Line 460  for ac_option ; do Line 485  for ac_option ; do
485          -make=* | --make=*)          -make=* | --make=*)
486              MAKE=$ac_optarg ;;              MAKE=$ac_optarg ;;
487    
488            -clean | --clean)
489                CLEANUP=t ;;
490    
491            -quick | --quick | -q | --q)
492                QUICK=t ;;
493            -nogenmake | --nogenmake | -ng | --ng)
494                NOGENMAKE=t ;;
495            -noclean | --noclean | -nc | --nc)
496                NOCLEAN=t ;;
497            -nodepend | --nodepend | -nd | --nd)
498                NODEPEND=t ;;
499    
500          -mpi) MPI=t ;;          -mpi) MPI=t ;;
501          -verbose) verbose=2 ;;          -verbose) verbose=2 ;;
502          -debug) debug=1 ;;          -debug) debug=1 ;;
# Line 480  for ac_option ; do Line 517  for ac_option ; do
517            
518  done  done
519    
520    if test "x$QUICK" = xt ; then
521        NOGENMAKE=t
522        NOCLEAN=t
523        NODEPEND=t
524    fi
525    
526  if test "x$TESTDIRS" = x ; then  if test "x$TESTDIRS" = x ; then
527      TESTDIRS=`scandirs`      TESTDIRS=`scandirs`
528  fi  fi
529    
530    if test "x$OPTFILE" = xNONE -a "x$MITGCM_OF" != x ; then
531        OPTFILE=$MITGCM_OF
532    fi
533    
534  echo "OK"  echo "OK"
535    
536  #  create the FORTRAN comparison code  #  create the FORTRAN comparison code
# Line 522  EOF Line 569  EOF
569    
570  NDIR=0  NDIR=0
571    
572  #  For each optfile...  if test "x$OPTFILE" != xNONE ; then
573  for OPTFILE in $OPTFILES ; do      if test -r $OPTFILE ; then
574            OPTFILE=`pwd`"/$OPTFILE"
     OPTFILE=`pwd`"/$OPTFILE"  
     if test ! -r $OPTFILE ; then  
         echo "Error: can't read optfile \"$OPTFILE\""  
         exit 1  
575      fi      fi
576      echo  fi
577      echo "OPTFILE=$OPTFILE" >> $SUMMARY  echo
578      echo >> $SUMMARY  echo "OPTFILE=$OPTFILE" >> $SUMMARY
579        echo >> $SUMMARY
     #  ...and each test directory...  
     for dir in $TESTDIRS ; do  
580    
581          #  Verify that the testdir exists and contains previous  #  ...and each test directory...
582          #  results in the correct location--or skip this directory!  for dir in $TESTDIRS ; do
583          if test ! -r $dir"/results/output.txt" ; then      
584              echo | tee -a $SUMMARY      #  Cleanup only!
585              echo "can't read \"$dir/results/output.txt\" -- skipping $dir" \      if test "x$CLEANUP" = xt ; then
586                  | tee -a $SUMMARY          if test -r $dir/build/Makefile ; then
587              continue              ( cd $dir/build ; make CLEAN )
         fi  
   
         #  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  
588          fi          fi
589            if test -r $dir/input/Makefile ; then
590                ( cd $dir/input ; make CLEAN )
591            fi
592            continue
593        fi
594    
595          #  Create an output dir for each OPTFILE/tdir combination      #  Verify that the testdir exists and contains previous
596          CDIR=$DRESULTS"/"$DRESULTS"_"$NDIR      #  results in the correct location--or skip this directory!
597          mkdir $CDIR      if test ! -r $dir"/results/output.txt" ; then
         CDIR=`pwd`"/$CDIR"  
   
         #  ...configue, make, run, and compare the output.  
         echo "-------------------------------------------------------------------------------"  
598          echo          echo
599          echo "Experiment:  $dir"          echo "can't read \"$dir/results/output.txt\" -- skipping $dir"
600          echo          echo
601          unset genmake makedepend make run          continue
602          results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'      fi
         ( cd $dir/input; rm -f *.{o,f,c,F} *.[f,F]90 work* output.txt Make* make.log; )  
         if [ -r $dir/build ]; then  
             seperatebuilddir=1  
             builddir=build  
             rundir=build  
             ( cd $dir/build; ln -sf ../input/* . )  
         else  
             seperatebuilddir=0  
             builddir=input  
             rundir=input  
         fi  
603    
604        echo "-------------------------------------------------------------------------------"
605        echo
606        echo "Experiment:  $dir"
607        echo
608        unset genmake makedepend make run
609        results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'
610    
611        if [ -r $dir/build ]; then
612            seperatebuilddir=1
613            builddir=build
614            rundir=build
615            ( cd $dir/build; ln -sf ../input/* . )
616        else
617            seperatebuilddir=0
618            builddir=input
619            rundir=input
620        fi
621        
622        CODE_DIR=$dir/code
623        BUILD_DIR=$dir/$builddir
624        MPI_FILES="CPP_EEOPTIONS.h_mpi SIZE.h_mpi"
625        NOMPI_FILES="CPP_EEOPTIONS.h_nompi SIZE.h_nompi"
626    
627        #  Is this an MPI run?
628        if test "x$MPI" = xt ; then
629            FILES=$MPI_FILES
630        else
631            FILES=$NOMPI_FILES
632        fi
633        
634        #  Check to see that we have the files
635        have_files=t
636        for i in $FILES ; do
637            if test ! -r $CODE_DIR/$i ; then
638                echo "Warning: can't read file $CODE_DIR/$i"
639                have_files=f
640            fi
641        done
642        if test "x$have_files" != xt -a "x$MPI" = xt ; then
643            echo "Skipping $dir due to lack of input files (see above warning)"
644            continue
645        fi
646        
647        #  If we have the $FILES and they differ, copy the $FILES to $BUILD_DIR
648        if test "x$have_files" = xt ; then
649            for i in $FILES ; do
650                cmp $CODE_DIR/$i $BUILD_DIR/$i > /dev/null 2>&1
651                RETVAL=$?
652                if test "x$RETVAL" != x0 ; then
653                    cp $CODE_DIR/$i $BUILD_DIR/$i
654                fi
655            done
656        fi
657        
658        #  Create an output dir for each OPTFILE/tdir combination
659        CDIR=$DRESULTS"/"$DRESULTS"_"$NDIR
660        mkdir $CDIR
661        CDIR=`pwd`"/$CDIR"
662        
663        if test "x$CLEANUP" = xt ; then
664            makeclean $dir/$builddir
665        else
666          genmakemodel $dir/$builddir && genmake=Y \          genmakemodel $dir/$builddir && genmake=Y \
667              && makeclean $dir/$builddir \              && makeclean $dir/$builddir \
668              && makedependmodel $dir/$builddir && makedepend=Y \              && makedependmodel $dir/$builddir && makedepend=Y \
# Line 597  for OPTFILE in $OPTFILES ; do Line 670  for OPTFILE in $OPTFILES ; do
670              && linkdata $seperatebuilddir $dir/$rundir \              && linkdata $seperatebuilddir $dir/$rundir \
671              && runmodel $dir/$builddir && run=Y \              && runmodel $dir/$builddir && run=Y \
672              && results=`testoutput $dir $rundir`              && results=`testoutput $dir $rundir`
673          echo      fi
674          formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \      
675              ${run:-N} $results      echo
676          echo      formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \
677          formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \          ${run:-N} $results
678              ${run:-N} $results >> $SUMMARY      echo
679          echo "fresults='" > $CDIR"/summary.txt"      formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \
680          formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \          ${run:-N} $results >> $SUMMARY
681              ${run:-N} $results >> $CDIR"/summary.txt"      echo "fresults='" > $CDIR"/summary.txt"
682          echo "'" >> $CDIR"/summary.txt"      formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \
683          echo "MACH='$MACH'" >> $CDIR"/summary.txt"          ${run:-N} $results >> $CDIR"/summary.txt"
684          echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"      echo "'" >> $CDIR"/summary.txt"
685          echo "DATE='$DATE'" >> $CDIR"/summary.txt"      echo "MACH='$MACH'" >> $CDIR"/summary.txt"
686          echo "tdir='$dir'" >> $CDIR"/summary.txt"      echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"
687        echo "DATE='$DATE'" >> $CDIR"/summary.txt"
688          (      echo "tdir='$dir'" >> $CDIR"/summary.txt"
689              cd $DRESULTS      
690              tar -cf $NDIR".tar" $DRESULTS"_"$NDIR > /dev/null 2>&1      (
691              gzip $NDIR".tar"          cd $DRESULTS
692          )          tar -cf $NDIR".tar" $DRESULTS"_"$NDIR > /dev/null 2>&1
693            gzip $NDIR".tar"
694        )
695        
696        if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then
697            echo "No mail sent"
698        else
699          $MPACK -s MITgcm-test -m 1000000 $DRESULTS"/"$NDIR".tar.gz" $ADDRESSES          $MPACK -s MITgcm-test -m 1000000 $DRESULTS"/"$NDIR".tar.gz" $ADDRESSES
700          RETVAL=$?          RETVAL=$?
701          if test "x$RETVAL" != x0 ; then          if test "x$RETVAL" != x0 ; then
# Line 625  for OPTFILE in $OPTFILES ; do Line 703  for OPTFILE in $OPTFILES ; do
703          else          else
704              rm -f $DRESULTS"/"$NDIR".tar*"              rm -f $DRESULTS"/"$NDIR".tar*"
705          fi          fi
706        fi
707    
708          NDIR=$(( $NDIR + 1 ))      echo "-------------------------------------------------------------------------------"
709                
710      done      NDIR=$(( $NDIR + 1 ))
711        
712  done  done
713    
714  rm tmp_cmpnum.f a.out  rm tmp_cmpnum.f a.out

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

  ViewVC Help
Powered by ViewVC 1.1.22