/[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.1 by edhill, Wed Aug 27 22:12:31 2003 UTC revision 1.9.2.7 by edhill, Fri Oct 3 19:12:27 2003 UTC
# Line 10  usage() Line 10  usage()
10      echo      echo
11      echo "where possible OPTIONS are:"      echo "where possible OPTIONS are:"
12      echo "  (-help|-h)               print usage"      echo "  (-help|-h)               print usage"
13      echo "  (-optfile=|-of=)STRING   list of genmake2 \"optfiles\""      echo "  (-mpi)                   use MPI input files"
14        echo "  (-optfile=|-of=)STRING   list of optfiles to use"
15      echo "  (-a|-addr)STRING         list of email recipients"      echo "  (-a|-addr)STRING         list of email recipients"
16      echo "  (-t|-tdir)STRING         list of \"test\" dirs"      echo "                             (DEF=\"edhill@mitgcm.org\")"
17        echo "  (-t|-tdir)STRING         list of test dirs to use"
18        echo "                             (DEF=\"\" which builds all)"
19        echo "  (-b|-bash)STRING         location of \"bash\" executable"
20        echo "                             (DEF=\"\" for \"/bin/bash\")"
21        echo "  (-c|-command)STRING      command to run"
22        echo "                             (DEF=\"make output.txt\")"
23        echo "  (-m|-make)STRING         command to use for \"make\""
24        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
30        echo "and where STRING follows a whitespace-delimited format"
31        echo "such as:"
32        echo "  -t 'exp0 exp2 exp3' "
33        echo "  -addr='abc@123.com testing@home.org'"
34      echo      echo
35      exit 1      exit 1
36  }  }
# Line 29  build_mpack() Line 47  build_mpack()
47              exit 1              exit 1
48          fi          fi
49          echo -n "building mpack...  "          echo -n "building mpack...  "
50          ( cd $MPACKDIR && ./configure && make ) > build_mpack.out 2>&1          ( cd $MPACKDIR && ./configure && $MAKE ) > build_mpack.out 2>&1
51          RETVAL=$?          RETVAL=$?
52          if test "x$RETVAL" != x0 ; then          if test "x$RETVAL" != x0 ; then
53              echo              echo
# Line 160  testoutput() Line 178  testoutput()
178  genmakemodel()  genmakemodel()
179  {  {
180      # genmakemodel directory      # genmakemodel directory
181      GENMAKE2="../../../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 --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          rm -f output.txt      else
218          printf 'make CLEAN ... ' 2>&1          (
219          if test -r Makefile ; then              cd $1;
220              make CLEAN >> make.log 2>&1              if test -e output.txt ; then
221              RETVAL=$?                  rm -f output.txt
             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 231  makemodel() Line 267  makemodel()
267          cd $1;          cd $1;
268          if test -r Makefile ; then          if test -r Makefile ; then
269              printf 'make ... ' 1>&2              printf 'make ... ' 1>&2
270              make >> make.log 2>&1              $MAKE >> make.log 2>&1
271              RETVAL=$?              RETVAL=$?
272              if test "x$RETVAL" != x0 ; then              if test "x$RETVAL" != x0 ; then
273                  tail make.log                  tail make.log
# Line 257  linkdata() Line 293  linkdata()
293    
294  runmodel()  runmodel()
295  {  {
296      # runmodel directory exe      # runmodel directory
297      #      #
298      #  runs the model "exe" in "directory" (exe is relative to directory)      #  runs "$COMMAND" in "directory"
299        #  (where "$COMMAND" is relative to "directory")
300      (      (
301          cd $1          cd $1
302          if [ -x $2 ]; then          printf 'runmodel: ' 1>&2
303              if [ $quick -eq 0 ]; then          # make output.txt
304                  rm -f output.txt          $COMMAND
305              fi          RETVAL=$?
306              printf 'runmodel: ' 1>&2          if test "x$RETVAL" = x0 ; then
307              make output.txt              cp output.txt $CDIR"/output.txt"
308              RETVAL=$?              return 0
309              if test "x$RETVAL" = x0 ; then          else
310                  cp output.txt $CDIR"/output.txt"              return 1
                 return 0  
             else  
                 return 1  
             fi  
311          fi          fi
312      )      )
313  }  }
# Line 315  EOFA Line 348  EOFA
348          return 0          return 0
349      else      else
350          echo          echo
351          echo "createcodelet: failed to compile codelet" | tee          echo "createcodelet: failed to compile codelet"
352          exit 1          exit 1
353      fi      fi
354  }  }
# Line 347  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 383  scandirs() Line 416  scandirs()
416  #  Default properties  #  Default properties
417  debug=0  debug=0
418  verbose=1  verbose=1
 quick=0  
419  clean=0  clean=0
 ieee=1  
420  expts=''  expts=''
421    # ieee=1
422    
423  OPTFILES=  CLEANUP=f
424  ADDRESSES=edhill@mitgcm.org  QUICK=f
425    NOGENMAKE=f
426    NOCLEAN=f
427    NODEPEND=f
428    
429    BASH=
430    OPTFILE=NONE
431    ADDRESSES=
432  TESTDIRS=  TESTDIRS=
433  MPACKDIR="../tools/mpack-1.6"  MPACKDIR="../tools/mpack-1.6"
434  MPACK="$MPACKDIR/mpack"  MPACK="$MPACKDIR/mpack"
435    COMMAND="make output.txt"
436    MAKE=make
437    MPI=f
438    
439  echo -n "parsing options...  "  echo -n "parsing options...  "
440    
# Line 413  for ac_option ; do Line 455  for ac_option ; do
455          -help | --help | -h | --h)          -help | --help | -h | --h)
456              usage ;;              usage ;;
457                    
458          -optfile | --optfile | -f | --f)          -optfile | --optfile | -of | --of)
459              ac_prev=OPTFILES ;;              ac_prev=OPTFILE ;;
460          -optfile=* | --optfile=*)          -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 428  for ac_option ; do Line 470  for ac_option ; do
470          -tdir=* | --tdir=*)          -tdir=* | --tdir=*)
471              TESTDIRS=$ac_optarg ;;              TESTDIRS=$ac_optarg ;;
472    
473          -quick) quick=1 ;;          -bash | --bash | -b | --b)
474                ac_prev=BASH ;;
475            -bash=* | --bash=*)
476                BASH=$ac_optarg ;;
477    
478            -command | --command | -c | --c)
479                ac_prev=COMMAND ;;
480            -command=* | --command=*)
481                COMMAND=$ac_optarg ;;
482    
483            -make | --make | -m | --m)
484                ac_prev=MAKE ;;
485            -make=* | --make=*)
486                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 ;;
501          -verbose) verbose=2 ;;          -verbose) verbose=2 ;;
502          -debug) debug=1 ;;          -debug) debug=1 ;;
503          -clean) clean=1 ;;          -clean) clean=1 ;;
         -noieee) ieee=0 ;;  
504          -quiet) verbose=0 ;;          -quiet) verbose=0 ;;
505    
506          -*)          -*)
# Line 449  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 463  build_mpack Line 541  build_mpack
541    
542  #  Create a uniquely named directory to store results  #  Create a uniquely named directory to store results
543  MACH=`hostname`  MACH=`hostname`
544    UNAMEA=`uname -a`
545  DATE=`date +%Y%m%d`  DATE=`date +%Y%m%d`
546  BASE=$MACH"_"$DATE"_"  BASE=$MACH"_"$DATE"_"
547  DNUM=0  DNUM=0
# Line 490  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
580    
581    #  ...and each test directory...
582    for dir in $TESTDIRS ; do
583            
584      #  ...and each test directory...      #  Cleanup only!
585      for dir in $TESTDIRS ; do      if test "x$CLEANUP" = xt ; then
586                    if test -r $dir/build/Makefile ; then
587          #  Create an output dir for each OPTFILE/tdir combination              ( cd $dir/build ; make CLEAN )
588          CDIR=$DRESULTS"/"$NDIR          fi
589          mkdir $CDIR          if test -r $dir/input/Makefile ; then
590          CDIR=`pwd`"/$CDIR"              ( cd $dir/input ; make CLEAN )
591            fi
592            continue
593        fi
594    
595          #  ...configue, make, run, and compare the output.      #  Verify that the testdir exists and contains previous
596          echo "-------------------------------------------------------------------------------"      #  results in the correct location--or skip this directory!
597        if test ! -r $dir"/results/output.txt" ; then
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
603          ( cd $dir/input; rm -f *.{o,f,c,F} *.[f,F]90 work* output.txt Make* make.log; )  
604          if [ -r $dir/build ]; then      echo "-------------------------------------------------------------------------------"
605              seperatebuilddir=1      echo
606              builddir=build      echo "Experiment:  $dir"
607              rundir=build      echo
608              ( cd $dir/build; ln -sf ../input/* . )      unset genmake makedepend make run
609          else      results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'
610              seperatebuilddir=0  
611              builddir=input      if [ -r $dir/build ]; then
612              rundir=input          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          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 \
669              && makemodel $dir/$builddir && make=Y \              && makemodel $dir/$builddir && make=Y \
670              && linkdata $seperatebuilddir $dir/$rundir \              && linkdata $seperatebuilddir $dir/$rundir \
671              && runmodel $dir/$builddir mitgcmuv && 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} ${run:-N} $results      
675          echo      echo
676          formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results >> $SUMMARY      formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \
677            ${run:-N} $results
678          ( cd $DRESULTS"/"$NDIR ; gzip * )      echo
679        formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \
680          tar -cf $DRESULTS"/"$NDIR".tar" $DRESULTS"/"$NDIR          ${run:-N} $results >> $SUMMARY
681          $MPACK -s MITgcm-test -m 1000000 $DRESULTS"/"$NDIR".tar" $ADDRESSES      echo "fresults='" > $CDIR"/summary.txt"
682        formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \
683            ${run:-N} $results >> $CDIR"/summary.txt"
684        echo "'" >> $CDIR"/summary.txt"
685        echo "MACH='$MACH'" >> $CDIR"/summary.txt"
686        echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"
687        echo "DATE='$DATE'" >> $CDIR"/summary.txt"
688        echo "tdir='$dir'" >> $CDIR"/summary.txt"
689        
690        (
691            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
700            RETVAL=$?
701            if test "x$RETVAL" != x0 ; then
702                echo "Warning: \"$MPACK\" failed -- please contact <edhill@mitgcm.org>"
703            else
704                rm -f $DRESULTS"/"$NDIR".tar*"
705            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
715    
 echo -------------------------------------------------------------------------------  
 echo  
 echo >> $SUMMARY  
 date >> $SUMMARY  
716  cat $SUMMARY  cat $SUMMARY
717    
 # tar -cf $DRESULTS".tar" $DRESULTS  
 #  
 # $MPACK -s MITgcm-test -m 1000000 $DRESULTS".tar" $ADDRESSES  
   

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

  ViewVC Help
Powered by ViewVC 1.1.22