--- MITgcm/verification/testreport 2006/07/31 20:48:41 1.87 +++ MITgcm/verification/testreport 2007/01/10 22:50:09 1.89 @@ -1,6 +1,6 @@ #! /usr/bin/env bash # -# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/verification/testreport,v 1.87 2006/07/31 20:48:41 jmc Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/verification/testreport,v 1.89 2007/01/10 22:50:09 jmc Exp $ # $Name: $ # @@ -15,12 +15,14 @@ echo " (-mpi) compile and run using MPI" echo " (-ieee|-noieee) if possible, use IEEE compiler flags" echo " (DEF=\"-ieee\")" - echo " (-optfile=|-of=)STRING list of optfiles to use" + echo " (-of=|-optfile=)STRING list of optfiles to use" echo " (-a|-addr) STRING list of email recipients" echo " (DEF=\"edhill@mitgcm.org\")" echo " (-t|-tdir) STRING list of group and/or exp. dirs to test" echo " (recognized groups: basic, tutorials)" echo " (DEF=\"\" which test all)" + echo " (-skd|-skipdir) STRING list of exp. dirs to skip" + echo " (DEF=\"\" which test all)" echo " (-b|-bash) STRING preferred location of a \"bash\" or" echo " Bourne-compatible \"sh\" shell" echo " (DEF=\"\" for \"bash\")" @@ -31,15 +33,15 @@ echo " (DEF=\"make\")" echo " (-odir) STRING used to build output directory name" echo " (DEF=\"hostname\")" - echo " (-ptracers|-ptr) STRING specify which ptracers to test" + echo " (-ptr|-ptracers) STRING specify which ptracers to test" echo " (DEF=\"1 2 3 4 5\")" echo " (-j) JOBS use \"make -j JOBS\" for parallel builds" echo " (-clean) *ONLY* run \"make CLEAN\"" - echo " (-quick|-q) same as \"-nogenmake -noclean -nodepend\"" - echo " (-nogenmake|-ng) skip the genmake stage" - echo " (-noclean|-nc) skip the \"make clean\" stage" - echo " (-nodepend|-nd) skip the \"make depend\" stage" - echo " (-deldir|-dd) on success, delete the output directory" + echo " (-q|-quick) same as \"-nogenmake -noclean -nodepend\"" + echo " (-ng|-nogenmake) skip the genmake stage" + echo " (-nc|-noclean) skip the \"make clean\" stage" + echo " (-nd|-nodepend) skip the \"make depend\" stage" + echo " (-dd|-deldir) on success, delete the output directory" echo echo "and where STRING can be a whitespace-delimited list" echo "such as:" @@ -536,28 +538,39 @@ printf 'runmodel in %s ...' $1 1>&2 # make output.txt echo - rm -f run.log if test ! -x $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then - echo " link" $EXECUTABLE "from dir ../"$builddir > run.log + echo " link" $EXECUTABLE "from dir ../"$builddir > run.log_00 ln -sf "../"$builddir"/"$EXECUTABLE . - else - touch run.log fi if test ! -x $EXECUTABLE ; then + rm -f run.log ; touch run.log + if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi echo " no executable:" $EXECUTABLE >> run.log RETVAL=8 + ENDVAL=-1 else if test $OUTPUTFILE -ot $EXECUTABLE ; then + rm -f run.log ; touch run.log + if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi ( eval $COMMAND ) >> run.log 2>&1 RETVAL=$? else - echo " $OUTPUTFILE is up to date " >> run.log 2>&1 RETVAL=0 + if test -f run.log ; then + if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi + echo "---------->> $OUTPUTFILE is up to date " >> run.log 2>&1 + else + touch run.log + if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi + echo "---------->> $OUTPUTFILE is up to date " >> run.log 2>&1 + echo " no previous run.log: assume NORMAL END" >> run.log 2>&1 + fi fi + ENDVAL=`cat run.log | grep -v 'ABNORMAL END' | grep -c 'NORMAL END'` fi - # echo "COMMAND='$COMMAND'" - # echo "pwd='"`pwd`"'" - if test "x$RETVAL" = x0 ; then + rm -f run.log_00 + #if test "x$RETVAL" = x0 ; then + if [ $RETVAL -eq 0 -a $ENDVAL -gt 0 ] ; then tail run.log echo successful 1>&2 # === Reduce the size of the testing emails! @@ -566,7 +579,7 @@ return 0 else tail run.log - echo failed 1>&2 + echo failed '(run:' $RETVAL ' end:' $ENDVAL ')' 1>&2 cp run.log $CDIR"/run.log" if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi return 1 @@ -640,25 +653,6 @@ } -show_help() -{ - cat - << EOF -$0 [-help] [-quick] [-verbose] dir1 [dir2] [...] - - -help|-h Show this help message - -quiet Reduce the amount of output - -verbose Produce copious amounts of output - -debug Produce even more output which will mean nothing to most - -force Do "make CLEAN" before compiling. This forces a complete rebuild. - -clean Do "make CLEAN" after compiling and testing. - -cleanup Aggresively removes all model output, executables and object files - and then exits. Use with care. - -Normal usage: - $0 * Configure, compile, run and analyze in all experiment directories -EOF -} - scandirs() { if [ $# -eq 1 ]; then @@ -698,6 +692,7 @@ OPTFILE=NONE ADDRESSES= TESTDIRS= +SKIPDIRS= MPACKDIR="../tools/mpack-1.6" HAVE_MPACK= MPACK="$MPACKDIR/mpack" @@ -753,6 +748,11 @@ -tdir=* | --tdir=*) TESTDIRS=$ac_optarg ;; + -skipdir | --skipdir | -skd | --skd) + ac_prev=SKIPDIRS ;; + -skipdir=* | --skipdir=*) + SKIPDIRS=$ac_optarg ;; + -bash | --bash | -b | --b) ac_prev=BASH ;; -bash=* | --bash=*) @@ -833,9 +833,9 @@ if test "x$TESTDIRS" = x ; then if test "x$ADM" = xt ; then - TESTDIRS=`scandirs results_ad` + LIST=`scandirs results_ad` else - TESTDIRS=`scandirs results` + LIST=`scandirs results` fi else #- expand group of experiments: @@ -852,19 +852,28 @@ *) LIST=${LIST}" "$xx ;; esac done - #echo 'LIST='${LIST}'<' - #- remove duplicate and non-directory: - TESTDIRS=" " - for xx in $LIST - do +fi +#echo 'LIST='${LIST}'<' +#- skip dirs, remove duplicate and non-directory: +TESTDIRS=" " +count=0 +for xx in $LIST +do + yy=`echo $SKIPDIRS | grep -c $xx` + if test $yy = 0 ; then if test -d $xx ; then yy=`echo $TESTDIRS | grep -c $xx` if test $yy = 0 ; then TESTDIRS=${TESTDIRS}" "$xx ; fi - else - echo " -- skip \"$xx\" : not a directory !" + else count=1 ; + echo ""; echo -n " -- skip \"$xx\" (not a directory !)" fi - done -fi + else + if test $count = 1 ; then echo -n ", \"$xx\"" + else count=1 ; echo "" ; echo -n " skip: \"$xx\"" + fi + fi +done +if test $count = 1 ; then echo "" ; echo -n " ... " ; fi #echo 'TESTDIRS='${TESTDIRS}'<' if test "x$OPTFILE" = xNONE -a "x$MITGCM_OF" != x ; then