/[MITgcm]/MITgcm/verification/testscript
ViewVC logotype

Diff of /MITgcm/verification/testscript

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.14 by adcroft, Wed Aug 15 17:17:01 2001 UTC revision 1.19.2.2 by dimitri, Thu Dec 5 08:06:18 2002 UTC
# Line 21  testoutput_for_prop() Line 21  testoutput_for_prop()
21   fi   fi
22   if [ -r $1/input/output.txt ]; then   if [ -r $1/input/output.txt ]; then
23    grep "$2" $1/input/output.txt | sed 's/.*=//' | nl > tmp1.txt    grep "$2" $1/input/output.txt | sed 's/.*=//' | nl > tmp1.txt
24      lncnt=`wc -l tmp1.txt | awk '{print $1}' `
25      if [ $lncnt -lt 3 ]; then
26       if [ $verbose -gt 0 ]; then
27        echo Not enough lines of output when searching for "$2" 1>&2
28       fi
29       return 99
30      fi
31   else   else
32    echo testoutput_for_prop: output.txt from model run was not readable 1>&2    echo testoutput_for_prop: output.txt from model run was not readable 1>&2
33    return 99    return 99
# Line 29  testoutput_for_prop() Line 36  testoutput_for_prop()
36    echo testoutput_for_prop: grep "$2" $1/results/output.txt 1>&2    echo testoutput_for_prop: grep "$2" $1/results/output.txt 1>&2
37   fi   fi
38   grep "$2" $1/results/output.txt | sed 's/.*=//' | nl > tmp2.txt   grep "$2" $1/results/output.txt | sed 's/.*=//' | nl > tmp2.txt
39      lncnt=`wc -l tmp2.txt | awk '{print $1}' `
40      if [ $lncnt -lt 3 ]; then
41       if [ $verbose -gt 0 ]; then
42        echo Not enough lines of output when searching for "$2" 1>&2
43       fi
44       return 99
45      fi
46   if [ $debug -gt 0 ]; then   if [ $debug -gt 0 ]; then
47    echo testoutput_for_prop: join tmp1.txt tmp2.txt 1>&2    echo testoutput_for_prop: join tmp1.txt tmp2.txt 1>&2
48   fi   fi
# Line 138  genmakemodel() Line 152  genmakemodel()
152   )   )
153  }  }
154    
155  makeclean()  makecleancompile()
156  {  {
157  # makedependmodel directory  # makecleancompile directory
158     ( cd $1;
159       if [ $force -gt 0 ]; then
160        rm -f output.txt
161        printf 'make clean ... ' 2>&1
162        make CLEAN >> make.log 2>&1
163        if [ $? -ne 0 ]; then
164          tail make.log
165          echo makecleancompile: make clean failed 1>&2
166          return 1
167        else
168          echo succesful 1>&2
169        fi
170       fi
171     )
172    }
173    
174    makecleanupafter()
175    {
176    # makeupafter directory
177   ( cd $1;   ( cd $1;
178     if [ $clean -gt 0 ]; then     if [ $clean -gt 0 ]; then
179        rm -f output.txt
180      printf 'make clean ... ' 2>&1      printf 'make clean ... ' 2>&1
181      make CLEAN >> make.log 2>&1      make CLEAN >> make.log 2>&1
182      if [ $? -ne 0 ]; then      if [ $? -ne 0 ]; then
183        tail make.log        tail make.log
184        echo makeclean: make clean failed 1>&2        echo makeupafter: make clean failed 1>&2
185        return 1        return 1
186      else      else
187        echo succesful 1>&2        echo succesful 1>&2
# Line 201  runmodel() Line 235  runmodel()
235    
236   ( cd $1   ( cd $1
237     if [ -x $2 ]; then     if [ -x $2 ]; then
238      if [ ! -r output.txt -o $quick -eq 0 ]; then      if [ $quick -eq 0 ]; then
239       echo runmodel: running... 1>&2       rm -f output.txt
      ( ./$2 > output.txt 2>&1 ) && return 0  
      return 1  
     else  
      echo runmodel: output.txt is newer than executable 1>&2  
      return 0  
240      fi      fi
241     else      printf 'runmodel: ' 1>&2
242      echo runmodel: executable \"$1/$2\" is missing 1>&2      make output.txt && return 0
243      return 1  #   if [ ! -r output.txt -o $quick -eq 0 ]; then
244    #    echo runmodel: running... 1>&2
245    #    ( ./$2 > output.txt 2>&1 ) && return 0
246    #    rm -f output.txt
247    #    ( make output.txt ) && return 0
248    #    return 1
249    #   else
250    #    echo runmodel: output.txt is newer than executable 1>&2
251    #    ( make output.txt ) && return 0
252    #    return 0
253    #   fi
254    #  else
255    #   echo runmodel: executable \"$1/$2\" is missing 1>&2
256    #   return 1
257     fi     fi
258   )   )
259  }  }
# Line 284  $0 [-help] [-quick] [-verbose] dir1 [dir Line 326  $0 [-help] [-quick] [-verbose] dir1 [dir
326   -quiet     Reduce the amount of output   -quiet     Reduce the amount of output
327   -verbose   Produce copious amounts of output   -verbose   Produce copious amounts of output
328   -debug     Produce even more output which will mean nothing to most   -debug     Produce even more output which will mean nothing to most
329   -clean     Do "make CLEAN" before compiling. This forces a complete rebuild.   -force     Do "make CLEAN" before compiling. This forces a complete rebuild.
330   -longtest  Compare numeric output for mean and s.d. of variables.   -clean     Do "make CLEAN" after compiling and testing.
331     -shorttest Don't compare numeric output for mean and s.d. of variables.
332   -noieee    By default, $0 uses the -ieee option for genmake. This turns it off.   -noieee    By default, $0 uses the -ieee option for genmake. This turns it off.
333     -cleanup   Aggresively removes all model output, executables and object files
334                and then exits. Use with care.
335    
336  Normal usage:  Normal usage:
337   $0 *       Configure, compile, run and analyze in all experiment directories   $0 *       Configure, compile, run and analyze in all experiment directories
# Line 305  else Line 350  else
350  fi  fi
351  }  }
352    
353    clean_up()
354    {
355    # Find all executables, object files, CPP'd source and model output
356    # and DELETE it.
357    for opt in '-name mitgcmuv*' '-name *.o' '-name *.f' '-name *.c' '-path *results -prune -o -name *.meta' '-path *results -prune -o -name *.data' '-type l'
358     do
359       echo Cleaning: find . $opt -exec rm {} \;
360       find . $opt -exec rm {} \;
361    done
362    }
363    
364  ###############################################################################  ###############################################################################
365    
366  # Main function  # Main function
# Line 313  fi Line 369  fi
369  debug=0  debug=0
370  verbose=1  verbose=1
371  quick=0  quick=0
372    force=0
373  clean=0  clean=0
374  ieee=1  ieee=1
375  longtest=0  longtest=1
376  expts=''  expts=''
377    
378  # Process arguments  # Process arguments
379  for arg in $@  for arg in $@
380  do  do
381   case $arg in   case $arg in
382       -cleanup) clean_up; exit 0;;
383     -quick) quick=1;;     -quick) quick=1;;
384     -verbose) verbose=2;;     -verbose) verbose=2;;
385     -debug) debug=1;;     -debug) debug=1;;
386       -force) force=1;;
387     -clean) clean=1;;     -clean) clean=1;;
388     -noieee) ieee=0;;     -noieee) ieee=0;;
389     -longtest) longtest=1;;     -shorttest) longtest=0;;
390     -quiet) verbose=0;;     -quiet) verbose=0;;
391     -help) show_help; exit 0;;     -help) show_help; exit 0;;
392     -*) echo Unrecognized option:$arg; exit 9;;     -*) echo Unrecognized option:$arg; exit 9;;
# Line 335  do Line 394  do
394   esac   esac
395  done  done
396    
397    if [ $force -gt 0 -a $quick -gt 0 ]; then
398     echo You specified -quick and -force together which conflict.
399     echo Please specify either -quick or -force or neither but not both.
400     exit 1
401    fi
402    
403  #if [ ${#expts} -eq 0 ]; then  #if [ ${#expts} -eq 0 ]; then
404  # echo Scanning all directories  # echo Scanning all directories
405  # for arg in *  # for arg in *
# Line 381  do Line 446  do
446    results='-- -- -- -- -- -- -- -- --'    results='-- -- -- -- -- -- -- -- --'
447   fi   fi
448   genmakemodel $dir/input && genmake=Y \   genmakemodel $dir/input && genmake=Y \
449   && makeclean $dir/input \   && makecleancompile $dir/input \
450   && makedependmodel $dir/input && makedepend=Y \   && makedependmodel $dir/input && makedepend=Y \
451   && makemodel $dir/input && make=Y \   && makemodel $dir/input && make=Y \
452   && runmodel $dir/input mitgcmuv && run=Y \   && runmodel $dir/input mitgcmuv && run=Y \
453   && results=`testoutput $dir`   && results=`testoutput $dir` \
454     && makecleanupafter $dir/input
455   echo   echo
456   formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results   formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results
457   echo   echo

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.19.2.2

  ViewVC Help
Powered by ViewVC 1.1.22