--- MITgcm/verification/testreport 2006/07/05 22:39:57 1.83 +++ MITgcm/verification/testreport 2006/07/31 20:48:41 1.87 @@ -1,6 +1,6 @@ #! /usr/bin/env bash # -# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/verification/testreport,v 1.83 2006/07/05 22:39:57 jmc Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/verification/testreport,v 1.87 2006/07/31 20:48:41 jmc Exp $ # $Name: $ # @@ -18,8 +18,9 @@ echo " (-optfile=|-of=)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 test dirs to use" - echo " (DEF=\"\" which builds all)" + echo " (-t|-tdir) STRING list of group and/or exp. dirs to test" + echo " (recognized groups: basic, tutorials)" + echo " (DEF=\"\" which test all)" echo " (-b|-bash) STRING preferred location of a \"bash\" or" echo " Bourne-compatible \"sh\" shell" echo " (DEF=\"\" for \"bash\")" @@ -90,14 +91,14 @@ { # testoutput_for_prop dir s1 label subdir extension # - # compares files in $dir/$subdir/output.txt and $dir/results/output.txt + # compares files $dir/$subdir/$OUTPUTFILE and $dir/results/output.txt # using search strings s1 and text label if [ $debug -gt 0 ]; then - echo testoutput_for_prop: grep "$2" $1/$4/output.txt 1>&2 + echo testoutput_for_prop: grep "$2" $1/$4/$OUTPUTFILE 1>&2 fi - if [ -r $1/$4/output.txt ]; then - grep "$2" $1/$4/output.txt | sed 's/.*=//' | cat -n > tmp1.txt + if [ -r $1/$4/$OUTPUTFILE ]; then + grep "$2" $1/$4/$OUTPUTFILE | sed 's/.*=//' | cat -n > tmp1.txt lncntA=`wc -l tmp1.txt | awk '{print $1}' ` if [ $lncntA -lt 3 ]; then if [ $verbose -gt 0 ]; then @@ -106,13 +107,13 @@ return 99 fi else - echo testoutput_for_prop: output.txt from model run was not readable 1>&2 + echo testoutput_for_prop: $OUTPUTFILE from model run was not readable 1>&2 return 99 fi if [ $debug -gt 0 ]; then - echo testoutput_for_prop: grep "$2" $1/results/output.txt$5 1>&2 + echo testoutput_for_prop: grep "$2" $1/results/output.$5 1>&2 fi - grep "$2" $1/results/output.txt$5 | sed 's/.*=//' | cat -n > tmp2.txt + grep "$2" $1/results/output.$5 | sed 's/.*=//' | cat -n > tmp2.txt lncntB=`wc -l tmp2.txt | awk '{print $1}' ` if [ $lncntB -lt 3 ]; then if [ $verbose -gt 0 ]; then @@ -128,12 +129,12 @@ fi has_nan=`cat tmp1.txt | grep -i nan | wc -l` if [ $has_nan -gt 0 ] ; then - echo testoutput_for_prop: output.txt contains $has_nan NaN values 1>&2 + echo testoutput_for_prop: $OUTPUTFILE contains $has_nan NaN values 1>&2 return 99 fi has_inf=`cat tmp1.txt | grep -i inf | wc -l` if [ $has_inf -gt 0 ] ; then - echo testoutput_for_prop: output.txt contains $has_inf Inf values 1>&2 + echo testoutput_for_prop: $OUTPUTFILE contains $has_inf Inf values 1>&2 return 99 fi if [ $debug -gt 0 ]; then @@ -183,9 +184,9 @@ testoutput_ad() { grep $3 $1/results_ad/output_adm.txt | awk '{print NR " " $5}' > t05.txt - grep $3 $1/$2/output_adm.txt | awk '{print NR " " $5}' > t15.txt + grep $3 $1/$2/$OUTPUTFILE | awk '{print NR " " $5}' > t15.txt grep $3 $1/results_ad/output_adm.txt | awk '{print NR " " $6}' > t06.txt - grep $3 $1/$2/output_adm.txt | awk '{print NR " " $6}' > t16.txt + grep $3 $1/$2/$OUTPUTFILE | awk '{print NR " " $6}' > t16.txt join t05.txt t15.txt > t5.txt join t06.txt t16.txt > t6.txt echo "-1" >> t5.txt @@ -340,7 +341,7 @@ else ( cd $1; - #if test -e output.txt ; then rm -f output.txt ; fi + #if test -e $OUTPUTFILE ; then rm -f $OUTPUTFILE ; fi if test -r Makefile ; then printf 'clean build-dir: make Clean ... ' 2>&1 $MAKE Clean >> make.log 2>&1 @@ -560,11 +561,7 @@ tail run.log echo successful 1>&2 # === Reduce the size of the testing emails! - # if test "x$ADM" = x ; then - # cp output.txt $CDIR"/output.txt" - # else - # cp output_adm.txt $CDIR"/output_adm.txt" - # fi + #cp $OUTPUTFILE $CDIR"/"$OUTPUTFILE if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi return 0 else @@ -840,7 +837,35 @@ else TESTDIRS=`scandirs results` fi +else + #- expand group of experiments: + LIST=" " + for xx in $TESTDIRS + do + case $xx in + 'basic') LIST=${LIST}" aim.5l_cs hs94.128x64x5 ideal_2D_oce" + LIST=${LIST}" lab_sea tutorial_baroclinic_gyre" + LIST=${LIST}" tutorial_global_oce_latlon tutorial_plume_on_slope" + ;; + 'tutorials') + LIST=${LIST}" "`ls | grep 'tutorial_'` ;; + *) LIST=${LIST}" "$xx ;; + esac + done + #echo 'LIST='${LIST}'<' + #- remove duplicate and non-directory: + TESTDIRS=" " + for xx in $LIST + do + 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 !" + fi + done fi +#echo 'TESTDIRS='${TESTDIRS}'<' if test "x$OPTFILE" = xNONE -a "x$MITGCM_OF" != x ; then OPTFILE=$MITGCM_OF @@ -854,13 +879,12 @@ OUTPUTFILE="output.txt" fi -if test "x$ADM" = xt -a "x$COMMAND" = x ; then - COMMAND="./$EXECUTABLE > $OUTPUTFILE" -fi - if test "x$COMMAND" = x ; then COMMAND="./$EXECUTABLE > $OUTPUTFILE" fi +if test "x$MPI" = xt ; then + OUTPUTFILE="STDOUT.0000" +fi #echo "OK" echo "OK (COMMAND= $COMMAND )" @@ -1034,7 +1058,7 @@ #echo "ex_run_dirs='$ex_run_dirs'" for exd in $ex_run_dirs ; do name=`echo $exd | sed -e 's/input.//g'` - outf="$dir/results/output.txt.$name" + outf="$dir/results/output.$name.txt" if test -f $outf -a -r $outf ; then if test "x$MULTI_THREAD" = "xt" ; then if test -r $dir"/"$exd"/eedata.mth" ; then @@ -1077,7 +1101,7 @@ && makemodel $dir/$builddir && make=Y \ && linkdata $dir/$rundir $input_dirs \ && runmodel $dir/$rundir && run=Y \ - && results=`testoutput $dir $rundir` + && results=`testoutput $dir $rundir "txt"` fi echo @@ -1102,7 +1126,7 @@ run_clean $dir/tr_run.$ex linkdata $dir/tr_run.$ex input.$ex input runmodel $dir/tr_run.$ex && run=Y \ - && results=`testoutput $dir tr_run.$ex "."$ex` + && results=`testoutput $dir tr_run.$ex ${ex}".txt"` fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}` fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` fres="$fres.$ex"