--- MITgcm/verification/testscript 2001/08/15 17:17:01 1.14 +++ MITgcm/verification/testscript 2001/09/04 17:17:48 1.19 @@ -138,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 @@ -201,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 + printf '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 ) } @@ -284,7 +312,8 @@ -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. @@ -313,6 +342,7 @@ debug=0 verbose=1 quick=0 +force=0 clean=0 ieee=1 longtest=0 @@ -325,6 +355,7 @@ -quick) quick=1;; -verbose) verbose=2;; -debug) debug=1;; + -force) force=1;; -clean) clean=1;; -noieee) ieee=0;; -longtest) longtest=1;; @@ -335,6 +366,12 @@ esac 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 * @@ -381,11 +418,12 @@ 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