--- MITgcm/verification/testreport 2005/02/04 16:41:42 1.66 +++ MITgcm/verification/testreport 2006/01/13 16:33:33 1.74 @@ -1,6 +1,6 @@ #! /usr/bin/env bash # -# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/verification/testreport,v 1.66 2005/02/04 16:41:42 edhill Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/verification/testreport,v 1.74 2006/01/13 16:33:33 edhill Exp $ # $Name: $ # @@ -27,6 +27,8 @@ echo " (DEF=\"make output.txt\")" echo " (-m|-make) STRING command to use for \"make\"" 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 " (DEF=\"1 2 3 4 5\")" echo " (-j) JOBS use \"make -j JOBS\" for parallel builds" @@ -95,8 +97,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 +112,29 @@ 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 + 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 + 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 + return 99 + fi if [ $debug -gt 0 ]; then echo testoutput_for_prop: join tmp1.txt tmp2.txt 1>&2 fi @@ -342,6 +360,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 @@ -630,6 +662,7 @@ NOGENMAKE=f NOCLEAN=f NODEPEND=f +POSTCLEAN=f BASH= OPTFILE=NONE @@ -647,6 +680,7 @@ fi JOBS= MPI=f +OUTDIR= DELDIR= ADM= @@ -703,6 +737,11 @@ -make=* | --make=*) MAKE=$ac_optarg ;; + -odir | --odir) + ac_prev=OUTDIR ;; + -odir=* | --odir=*) + OUTDIR=$ac_optarg ;; + -ptracers | --ptracers | -ptr | --ptr) ac_prev=PTRACERS_NUM ;; -ptracers=* | --ptracers=* | -ptr=* | --ptr=*) @@ -712,7 +751,7 @@ -j=*) JOBS=$ac_optarg ;; -clean | --clean) - CLEANUP=t ;; + CLEANUP=t ; DELDIR=t ;; -quick | --quick | -q | --q) QUICK=t ;; @@ -723,6 +762,9 @@ -nodepend | --nodepend | -nd | --nd) NODEPEND=t ;; + -postclean | --postclean | -pc | --pc) + POSTCLEAN=t ;; + -mpi) MPI=t ;; -adm | -ad) ADM=t ;; @@ -789,6 +831,9 @@ UNAMEA=`uname -a` DATE=`date +%Y%m%d` BASE="tr_"$MACH"_"$DATE"_" +if test "x$OUTDIR" != x ; then + BASE="tr_"$OUTDIR"_"$DATE"_" +fi DNUM=0 DRESULTS="$BASE$DNUM" while test -e $DRESULTS ; do @@ -946,7 +991,7 @@ echo "Experiment: $dir" echo unset genmake makedepend make run - results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' + results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' # Create an output dir for each OPTFILE/tdir combination rel_CDIR=$DRESULTS"/"$dir @@ -978,6 +1023,12 @@ echo "tdir='$dir'" >> $CDIR"/summary.txt" for ex in $extra_runs ; do + unset run + results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' + # Create an output dir for each OPTFILE/tdir.ex combination + rel_CDIR=$DRESULTS"/"$dir"."$ex + mkdir $rel_CDIR + CDIR=`pwd`"/$rel_CDIR" test ! -e "$dir/tr_run.$ex" && mkdir "$dir/tr_run.$ex" for ldir in input.$ex input ; do ( @@ -998,9 +1049,11 @@ 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 + ls -1 2>/dev/null + ) > tr_exrun_tmp + echo "Makefile" > tr_exrun_links + echo "mitgcmuv" >> tr_exrun_links + cat tr_exrun_tmp | grep '\.[fFhco]$' >> tr_exrun_links ( cd "$dir/tr_run.$ex" cat ../../tr_exrun_links | while read i ; do @@ -1009,6 +1062,7 @@ fi done ) + test -e tr_exrun_tmp && rm -f tr_exrun_tmp test -e tr_exrun_links && rm -f tr_exrun_links runmodel $dir/tr_run.$ex && run=Y \ && results=`testoutput $dir tr_run.$ex "."$ex` @@ -1021,7 +1075,7 @@ echo "MACH='$MACH'" >> $CDIR"/summary.txt" echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" echo "DATE='$DATE'" >> $CDIR"/summary.txt" - echo "tdir='$dir'" >> $CDIR"/summary.txt" + echo "tdir='$dir.$ex'" >> $CDIR"/summary.txt" done else fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}` @@ -1034,6 +1088,8 @@ echo "DATE='$DATE'" >> $CDIR"/summary.txt" echo "tdir='$dir'" >> $CDIR"/summary.txt" fi + + postclean $dir/$builddir echo "-------------------------------------------------------------------------------"