--- MITgcm/verification/testscript 2001/08/10 16:49:51 1.10 +++ MITgcm/verification/testscript 2001/08/21 15:51:17 1.18 @@ -122,7 +122,11 @@ ( cd $1; if [ $quick -eq 0 -o ! -r Makefile ]; then printf 'genmake ... ' 1>&2 - ../../../tools/genmake -ieee -mods=../code > make.log 2>&1 + if [ $ieee -eq 0 ]; then + ../../../tools/genmake -mods=../code > make.log 2>&1 + else + ../../../tools/genmake -ieee -mods=../code > make.log 2>&1 + fi if [ $? -ne 0 ]; then tail make.log echo genmakemodel: genmake failed 1>&2 @@ -134,16 +138,36 @@ ) } -makeclean() +makecleancompile() { -# makedependmodel directory +# makecleancompile directory + ( cd $1; + if [ $force -gt 0 ]; then + rm -f output.txt + printf 'make clean ... ' 2>&1 + make CLEAN >> make.log 2>&1 + if [ $? -ne 0 ]; then + tail make.log + echo makecleancompile: make clean failed 1>&2 + return 1 + else + echo succesful 1>&2 + fi + fi + ) +} + +makecleanupafter() +{ +# makeupafter directory ( cd $1; if [ $clean -gt 0 ]; then + rm -f output.txt printf 'make clean ... ' 2>&1 make CLEAN >> make.log 2>&1 if [ $? -ne 0 ]; then tail make.log - echo makeclean: make clean failed 1>&2 + echo makeupafter: make clean failed 1>&2 return 1 else echo succesful 1>&2 @@ -197,17 +221,25 @@ ( cd $1 if [ -x $2 ]; then - if [ ! -r output.txt -o $quick -eq 0 ]; then - echo runmodel: running... 1>&2 - ( ./$2 > output.txt 2>&1 ) && return 0 - return 1 - else - echo runmodel: output.txt is newer than executable 1>&2 - return 0 + if [ $quick -eq 0 ]; then + rm -f output.txt fi - else - echo runmodel: executable \"$1/$2\" is missing 1>&2 - return 1 + echo -n "runmodel: " 1>&2 + make output.txt && return 0 +# if [ ! -r output.txt -o $quick -eq 0 ]; then +# echo runmodel: running... 1>&2 +# ( ./$2 > output.txt 2>&1 ) && return 0 +# rm -f output.txt +# ( make output.txt ) && return 0 +# return 1 +# else +# echo runmodel: output.txt is newer than executable 1>&2 +# ( make output.txt ) && return 0 +# return 0 +# fi +# else +# echo runmodel: executable \"$1/$2\" is missing 1>&2 +# return 1 fi ) } @@ -280,14 +312,28 @@ -quiet Reduce the amount of output -verbose Produce copious amounts of output -debug Produce even more output which will mean nothing to most - -clean Do "make CLEAN" before compiling. This forces a complete rebuild. + -force Do "make CLEAN" before compiling. This forces a complete rebuild. + -clean Do "make CLEAN" after compiling and testing. -longtest Compare numeric output for mean and s.d. of variables. + -noieee By default, $0 uses the -ieee option for genmake. This turns it off. Normal usage: $0 * Configure, compile, run and analyze in all experiment directories EOF } +scandirs() +{ +if [ $# -eq 0 ]; then + for arg in * + do + test -d $arg/input && echo $arg + done +else + echo $* +fi +} + ############################################################################### # Main function @@ -296,7 +342,9 @@ debug=0 verbose=1 quick=0 +force=0 clean=0 +ieee=1 longtest=0 expts='' @@ -307,22 +355,32 @@ -quick) quick=1;; -verbose) verbose=2;; -debug) debug=1;; + -force) force=1;; -clean) clean=1;; + -noieee) ieee=0;; -longtest) longtest=1;; -quiet) verbose=0;; -help) show_help; exit 0;; + -*) echo Unrecognized option:$arg; exit 9;; *) test -d $arg && expts=`echo $expts $arg`;; esac done -if [ ${#expts} -eq 0 ]; then - echo Scanning all directories - for arg in * - do - test -d $arg && expts=`echo $expts $arg` - done +if [ $force -gt 0 -a $quick -gt 0 ]; then + echo You specified -quick and -force together which conflict. + echo Please specify either -quick or -force or neither but not both. + exit 1 fi +#if [ ${#expts} -eq 0 ]; then +# echo Scanning all directories +# for arg in * +# do +# test -d $arg && expts=`echo $expts $arg` +# done +#fi +expts=`scandirs $expts` + createcodelet if [ $longtest -gt 0 ]; then @@ -354,14 +412,18 @@ echo Experiment: $dir echo unset genmake makedepend make run - results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' - results='-- -- -- -- -- -- -- -- --' + if [ $longtest -gt 0 ]; then + results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' + else + results='-- -- -- -- -- -- -- -- --' + fi genmakemodel $dir/input && genmake=Y \ - && makeclean $dir/input \ + && makecleancompile $dir/input \ && makedependmodel $dir/input && makedepend=Y \ && makemodel $dir/input && make=Y \ && runmodel $dir/input mitgcmuv && run=Y \ - && results=`testoutput $dir` + && results=`testoutput $dir` \ + && makecleanupafter $dir/input echo formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results echo