--- MITgcm/verification/testreport 2003/11/26 15:04:42 1.20 +++ MITgcm/verification/testreport 2003/11/29 01:45:25 1.23 @@ -1,6 +1,6 @@ #! /usr/bin/env bash # -# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/verification/testreport,v 1.20 2003/11/26 15:04:42 edhill Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/verification/testreport,v 1.23 2003/11/29 01:45:25 edhill Exp $ # $Name: $ # @@ -70,15 +70,6 @@ echo "OK" } -compare_lines() -{ - # use codelet to compare lines - if [ $verbose -gt 1 ]; then - cat tmp3.txt 1>&2 - fi - return `./a.out < tmp3.txt` -} - testoutput_for_prop() { # testoutput_for_prop dir s1 label subdir @@ -120,8 +111,13 @@ if [ $debug -gt 0 ]; then echo testoutput_for_prop: compare_lines 1>&2 fi - compare_lines - digits_of_similarity=$? + if [ $verbose -gt 1 ]; then + cat tmp3.txt 1>&2 + fi + echo "-1" >> tmp3.txt + # On the SGI O3K (*not* the O2K), "cat -n" inserts a ":" after the line number + cat tmp3.txt | sed -e 's|:||g' > tmp4.txt + digits_of_similarity=`./tmp_cmpnum < tmp4.txt` if [ $digits_of_similarity -eq 99 ]; then if [ $verbose -gt 0 ]; then echo testoutput_for_prop: No comparison was available for \"$2\" 1>&2 @@ -132,7 +128,7 @@ echo There were $digits_of_similarity decimal places of similarity for \"$2\" 1>&2 fi fi - rm tmp1.txt tmp2.txt tmp3.txt + rm -f tmp1.txt tmp2.txt tmp3.txt tmp4.txt return $digits_of_similarity } @@ -198,24 +194,18 @@ command="$GENMAKE2 -ds -m $MAKE --mods=../code" if test "x$OPTFILE" != xNONE ; then command="$command --optfile=$OPTFILE" - # echo " command=\"$command\"" fi if test "x$IEEE" != x ; then command="$command -ieee" fi - # echo "command: \"$command\"" printf 'genmake ... ' 1>&2 $command > make.log 2>&1 RETVAL=$? - for i in genmake_state genmake_optfile genmake_local Makefile ; do - if test -r $i ; then - cp $i $CDIR - fi - done + cp Makefile $CDIR if test "x$RETVAL" != x0 ; then tail make.log echo "genmakemodel: genmake failed" 1>&2 - cp make.log $CDIR + cp genmake_* make.log $CDIR return 1 else echo "successful" 1>&2 @@ -344,38 +334,41 @@ # create codelet for comparing model output echo -n "creating the comparison code... " - cat > tmp_cmpnum.f < tmp_cmpnum.c < +#include +int main( int argc, char** argv ) { + int linnum,best; + double a,b,diff; + best = -16; + while( 1 ) { + scanf("%d", &linnum); + if (linnum == -1) break; + scanf("%lf", &a); scanf("%lf", &b); + diff = 0.5*(fabs(a)+fabs(b)); + if (diff > 1.e-12) { + diff=fabs(a-b)/diff; + if (diff > 0.0) { + linnum = (int)log10(diff); + best = (best > linnum) ? best : linnum; + } + else { + if (best == -16 && diff != 0) best = -22; + } + } + } + printf("%d\n", -best); + return 0; +} +EOF + cc -o tmp_cmpnum tmp_cmpnum.c -lm - f77 tmp_cmpnum.f - if [ -x ./a.out ]; then + if [ -x ./tmp_cmpnum ]; then echo "OK" return 0 else echo - echo "createcodelet: failed to compile codelet" + echo "ERROR: failed to compile comparison code" exit 1 fi } @@ -435,8 +428,6 @@ ############################################################################### -############################################################################### -############################################################################### # Default properties @@ -596,16 +587,6 @@ echo -n "Start time: " >> $SUMMARY start_date=`date` echo $start_date > $SUMMARY -cat << EOF | tee -a $SUMMARY - T S U V -G D M c m s m s m s m s -E p a R g m m e . m m e . m m e . m m e . -N n k u 2 i a a d i a a d i a a d i a a d -2 d e n d n x n . n x n . n x n . n x n . - -EOF - -NDIR=0 of_path= if test "x$OPTFILE" != xNONE ; then @@ -619,14 +600,29 @@ fi file=${OPTFILE##*/} OPTFILE=$of_path/$file + cp $OPTFILE $DRESULTS + echo >> $SUMMARY + echo " OPTFILE=$OPTFILE" >> $SUMMARY else - echo - echo "WARNING: can't read OPTFILE=\"$OPTFILE\" but will try to use it..." + echo | tee $SUMMARY + echo "ERROR: can't read OPTFILE=\"$OPTFILE\"" | tee $SUMMARY + exit 1 fi +else + echo >> $SUMMARY + echo "No \"OPTFILE\" was explicitly specified by testreport," >> $SUMMARY + echo " so the genmake default will be used." >> $SUMMARY fi echo -echo "OPTFILE=$OPTFILE" >> $SUMMARY echo >> $SUMMARY +cat << EOF | tee -a $SUMMARY + T S U V +G D M c m s m s m s m s +E p a R g m m e . m m e . m m e . m m e . +N n k u 2 i a a d i a a d i a a d i a a d +2 d e n d n x n . n x n . n x n . n x n . + +EOF # ...and each test directory... for dir in $TESTDIRS ; do @@ -724,15 +720,10 @@ fi echo - formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \ - ${run:-N} $results + fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` echo - formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \ - ${run:-N} $results >> $SUMMARY - echo "fresults='" > $CDIR"/summary.txt" - formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \ - ${run:-N} $results >> $CDIR"/summary.txt" - echo "'" >> $CDIR"/summary.txt" + echo "$fres" >> $SUMMARY + echo "fresults='$fres'" > $CDIR"/summary.txt" echo "MACH='$MACH'" >> $CDIR"/summary.txt" echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" echo "DATE='$DATE'" >> $CDIR"/summary.txt" @@ -740,8 +731,6 @@ echo "-------------------------------------------------------------------------------" - NDIR=$(( $NDIR + 1 )) - done echo -n "Start time: " >> $SUMMARY @@ -776,7 +765,8 @@ fi fi -rm tmp_cmpnum.f a.out +# rm -f tmp_cmpnum.f a.out +rm -f tmp_cmpnum.c tmp_cmpnum if test "x$CLEANUP" != xt ; then cat $SUMMARY