--- MITgcm/verification/testreport 2004/12/16 20:25:11 1.61 +++ MITgcm/verification/testreport 2005/06/07 22:21:47 1.68 @@ -1,6 +1,6 @@ #! /usr/bin/env bash # -# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/verification/testreport,v 1.61 2004/12/16 20:25:11 edhill Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/verification/testreport,v 1.68 2005/06/07 22:21:47 edhill Exp $ # $Name: $ # @@ -95,8 +95,8 @@ fi if [ -r $1/$4/output.txt ]; then grep "$2" $1/$4/output.txt | sed 's/.*=//' | cat -n > tmp1.txt - lncnt=`wc -l tmp1.txt | awk '{print $1}' ` - if [ $lncnt -lt 3 ]; then + lncntA=`wc -l tmp1.txt | awk '{print $1}' ` + if [ $lncntA -lt 3 ]; then if [ $verbose -gt 0 ]; then echo Not enough lines of output when searching for "$2" 1>&2 fi @@ -110,13 +110,19 @@ echo testoutput_for_prop: grep "$2" $1/results/output.txt$5 1>&2 fi grep "$2" $1/results/output.txt$5 | sed 's/.*=//' | cat -n > tmp2.txt - lncnt=`wc -l tmp2.txt | awk '{print $1}' ` - if [ $lncnt -lt 3 ]; then + lncntB=`wc -l tmp2.txt | awk '{print $1}' ` + if [ $lncntB -lt 3 ]; then if [ $verbose -gt 0 ]; then echo Not enough lines of output when searching for "$2" 1>&2 fi return 99 fi + if [ $lncntA -ne $lncntB ]; then + if [ $verbose -gt 0 ]; then + echo Not same Nb of lines when searching for "$2" ":" $lncntA $lncntB 1>&2 + fi + return 99 + fi if [ $debug -gt 0 ]; then echo testoutput_for_prop: join tmp1.txt tmp2.txt 1>&2 fi @@ -294,6 +300,9 @@ if test "x$IEEE" != x ; then command="$command -ieee" fi + if test "x$MPI" = xt ; then + command="$command -mpi" + fi printf 'genmake ... ' 1>&2 $command > make.log 2>&1 RETVAL=$? @@ -339,6 +348,20 @@ fi } +postclean() +{ + # postclean directory + if test "x$POSTCLEAN" = xt ; then + ( + cd $1; + if test -r Makefile ; then + $MAKE CLEAN >> /dev/null 2>&1 + fi + exit 0 + ) + fi +} + makedependmodel() { # makedependmodel directory @@ -529,7 +552,7 @@ abave = 0.5*(fabs(a)+fabs(b)); if (abave > 0.0) { relerr=fabs(a-b)/abave; - if (relerr > 0.0) { linnum = (int)log10(relerr); } + if (relerr > 0.0) { linnum = (int)rint(log10(relerr)); } else { linnum = -16 ; } best = (best > linnum) ? best : linnum; } @@ -627,6 +650,7 @@ NOGENMAKE=f NOCLEAN=f NODEPEND=f +POSTCLEAN=f BASH= OPTFILE=NONE @@ -720,6 +744,9 @@ -nodepend | --nodepend | -nd | --nd) NODEPEND=t ;; + -postclean | --postclean | -pc | --pc) + POSTCLEAN=t ;; + -mpi) MPI=t ;; -adm | -ad) ADM=t ;; @@ -875,6 +902,10 @@ if test -r $dir/input/Makefile ; then ( cd $dir/input ; make CLEAN ) fi + ( + cd $dir + rm -rf tr_run.* + ) continue fi @@ -972,7 +1003,7 @@ for ex in $extra_runs ; do test ! -e "$dir/tr_run.$ex" && mkdir "$dir/tr_run.$ex" - for ldir in build input input.$ex ; do + for ldir in input.$ex input ; do ( cd "$dir/$ldir" > /dev/null 2>&1 ls -1 2>/dev/null \ @@ -982,13 +1013,27 @@ cd "$dir/tr_run.$ex" cat ../../tr_exrun_links | while read i ; do if test ! "x$i" = x ; then - test -e $i && rm -f $i - ln -s "../"$ldir"/"$i $i + test ! -r $i && ln -s "../"$ldir"/"$i $i fi done ) test -e tr_exrun_links && rm -f tr_exrun_links done + ldir=build + ( + cd "$dir/$ldir" > /dev/null 2>&1 + ls -1 Makefile *.[fFhco] mitgcmuv 2>/dev/null \ + | sed -e 's|^CVS$||g' | sed -e 's|^output.txt$||g' + ) > tr_exrun_links + ( + cd "$dir/tr_run.$ex" + cat ../../tr_exrun_links | while read i ; do + if test ! "x$i" = x ; then + test ! -r $i && ln -s "../"$ldir"/"$i $i + fi + done + ) + test -e tr_exrun_links && rm -f tr_exrun_links runmodel $dir/tr_run.$ex && run=Y \ && results=`testoutput $dir tr_run.$ex "."$ex` fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}` @@ -1013,6 +1058,8 @@ echo "DATE='$DATE'" >> $CDIR"/summary.txt" echo "tdir='$dir'" >> $CDIR"/summary.txt" fi + + postclean $dir/$builddir echo "-------------------------------------------------------------------------------" @@ -1054,11 +1101,11 @@ rm -f tmp_cmpnum.c tmp_cmpnum if test "x$CLEANUP" != xt ; then - cat $SUMMARY + cat $SUMMARY | sed 's/ -- -- -- --//g' if test -e tr_out.txt ; then mv tr_out.txt tr_out.txt.old fi - cat $SUMMARY > tr_out.txt + cat $SUMMARY | sed 's/ -- -- -- --//g' > tr_out.txt fi if test "x$DELDIR" = xt ; then