--- MITgcm/verification/testreport 2004/12/09 16:41:41 1.56 +++ 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.56 2004/12/09 16:41:41 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 @@ -450,7 +473,7 @@ if test "x$ADM" = x ; then files=`( cd ../input ; ls -1 | grep -v CVS )` for i in $files ; do - if test ! -d "../input/"$i ; then + if test ! -d "../input/"$i -a ! -f $i ; then ln -sf "../input/"$i $i fi done @@ -520,7 +543,7 @@ int main( int argc, char** argv ) { int linnum,best,lncnt; double a,b,abave,relerr; - best = -16; + best = -22; lncnt = 0; while( 1 & (lncnt+=1) < 999 ) { scanf("%d", &linnum); @@ -529,13 +552,9 @@ abave = 0.5*(fabs(a)+fabs(b)); if (abave > 0.0) { relerr=fabs(a-b)/abave; - if (relerr > 0.0) { - linnum = (int)log10(relerr); - best = (best > linnum) ? best : linnum; - } - } - else { - if (best == -16) best = -22; + if (relerr > 0.0) { linnum = (int)rint(log10(relerr)); } + else { linnum = -16 ; } + best = (best > linnum) ? best : linnum; } } if (lncnt == 999) best=-29; @@ -543,14 +562,15 @@ return 0; } EOF - cc -o tmp_cmpnum tmp_cmpnum.c -lm + $CC -o tmp_cmpnum tmp_cmpnum.c -lm if [ -x ./tmp_cmpnum ]; then echo "OK" return 0 else echo - echo "ERROR: failed to compile comparison code" + echo "ERROR: failed to compile comparison code -- please specify" + echo " a C compiler using the CC environment variable." exit 1 fi } @@ -630,6 +650,7 @@ NOGENMAKE=f NOCLEAN=f NODEPEND=f +POSTCLEAN=f BASH= OPTFILE=NONE @@ -639,7 +660,12 @@ HAVE_MPACK= MPACK="$MPACKDIR/mpack" COMMAND= -MAKE=make +if test "x$MAKE" = x ; then + MAKE=make +fi +if test "x$CC" = x ; then + CC=cc +fi JOBS= MPI=f DELDIR= @@ -718,6 +744,9 @@ -nodepend | --nodepend | -nd | --nd) NODEPEND=t ;; + -postclean | --postclean | -pc | --pc) + POSTCLEAN=t ;; + -mpi) MPI=t ;; -adm | -ad) ADM=t ;; @@ -873,6 +902,10 @@ if test -r $dir/input/Makefile ; then ( cd $dir/input ; make CLEAN ) fi + ( + cd $dir + rm -rf tr_run.* + ) continue fi @@ -969,24 +1002,38 @@ echo "tdir='$dir'" >> $CDIR"/summary.txt" for ex in $extra_runs ; do - test -e "$dir/tr_run.$ex" && rm -rf "$dir/tr_run.$ex" - mkdir "$dir/tr_run.$ex" - links=`( cd "$dir/input" > /dev/null 2>&1 ; ls -1 | grep -v CVS )` + test ! -e "$dir/tr_run.$ex" && mkdir "$dir/tr_run.$ex" + for ldir in input.$ex input ; do + ( + cd "$dir/$ldir" > /dev/null 2>&1 + ls -1 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 + 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" - for i in $links; do - ln -s ../input/$i $i - done - ) - links=`( cd "$dir/input.$ex" > /dev/null 2>&1 ; ls -1 | grep -v CVS )` - ( - cd "$dir/tr_run.$ex" - for i in $links; do - test -e $i && rm -f $i - ln -s ../input.$ex/$i $i - done - ln -s ../$builddir/mitgcmuv mitgcmuv + 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}` @@ -1011,6 +1058,8 @@ echo "DATE='$DATE'" >> $CDIR"/summary.txt" echo "tdir='$dir'" >> $CDIR"/summary.txt" fi + + postclean $dir/$builddir echo "-------------------------------------------------------------------------------" @@ -1052,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