/[MITgcm]/MITgcm/tools/do_tst_2+2
ViewVC logotype

Diff of /MITgcm/tools/do_tst_2+2

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.11 by jmc, Fri Jan 21 19:41:35 2011 UTC revision 1.16 by jmc, Thu Oct 11 16:30:56 2012 UTC
# Line 28  CLEAN=0 Line 28  CLEAN=0
28  TESTDIRS=  TESTDIRS=
29  SKIPDIRS=  SKIPDIRS=
30  SCRIPT='../tools/tst_2+2'  SCRIPT='../tools/tst_2+2'
31    LOGFILE='tst_2+2_out.log'
32  scrArg='All'  scrArg='All'
33  COMMAND=  COMMAND=
34  mpi=0  mpi=0
# Line 78  do Line 79  do
79  done  done
80    
81  if test -x $SCRIPT ; then  if test -x $SCRIPT ; then
82   echo "run script '$SCRIPT' for experiment in:"   if test $CLEAN = 1 ; then
83       echo "clean output from script '$SCRIPT' for experiment in:"
84     else
85       echo "run script '$SCRIPT' for experiment in:"
86     fi
87   echo " $LIST"   echo " $LIST"
88     echo ""
89   yy=`echo $SCRIPT | grep -c '^\/'`   yy=`echo $SCRIPT | grep -c '^\/'`
90   if test $yy = 0 ; then SCRIPT="../../$SCRIPT" ; fi   if test $yy = 0 ; then SCRIPT="../../$SCRIPT" ; fi
91  else  else
92   echo "ERROR: script '$SCRIPT' not found or not executable"   echo "ERROR: script '$SCRIPT' not found or not executable"
93   exit   exit
94  fi  fi
 echo ""  
95  #------------------------  #------------------------
96    
97  if test $CLEAN = 1 ; then  if test $CLEAN = 1 ; then
# Line 98  if test $CLEAN = 1 ; then Line 103  if test $CLEAN = 1 ; then
103      if test -r $xx/$yy/data.tst ; then      if test -r $xx/$yy/data.tst ; then
104        echo "clean dir:" $xx/$yy        echo "clean dir:" $xx/$yy
105        cd $xx/$yy        cd $xx/$yy
106        echo ' ' >> outp.tst_2+2.log        echo ' ' >> $LOGFILE
107        echo $SCRIPT 4 >> outp.tst_2+2.log        echo $SCRIPT 4 >> $LOGFILE
108        $SCRIPT 4 >> outp.tst_2+2.log 2>&1        $SCRIPT 4 >> $LOGFILE 2>&1
109        cd $here        cd $here
110      fi      fi
111    done    done
# Line 115  for xx in "$@" ; do nw=`echo $xx | wc -w Line 120  for xx in "$@" ; do nw=`echo $xx | wc -w
120                          else CMDLINE="$CMDLINE '$xx'" ; fi                          else CMDLINE="$CMDLINE '$xx'" ; fi
121  done  done
122  #for xx in "$@" ; do CMDLINE="$CMDLINE '$xx'" ; done  #for xx in "$@" ; do CMDLINE="$CMDLINE '$xx'" ; done
123  DATE=`date +%Y%m%d`  DATE=''
124    if test -f tr_out.txt ; then
125    #  try to use the date corresponding to 'Start time:' in file "tr_out.txt" :
126      sTime=`grep '^Start time:  ' tr_out.txt 2>/dev/null | sed 's/Start time:  //'`
127      if test "x$sTime" != x ; then DATE=`date -d "$sTime" "+%Y%m%d" 2>/dev/null` ; fi
128    fi
129    #  otherwise, use current date:
130    if test "x$DATE" = x ; then DATE=`date +%Y%m%d`; fi
131  BASE="rs_"$OUTDIR"_"$DATE"_"  BASE="rs_"$OUTDIR"_"$DATE"_"
132  xx=0  xx=0
133  DRESULTS="$BASE$xx"  DRESULTS="$BASE$xx"
# Line 155  fi Line 167  fi
167    
168  for xx in $LIST  for xx in $LIST
169  do  do
170    echo ==============================================================================    echo '------------------------------------------------------------------------------'
171    if [ $mpi -le 0 ] ; then    if [ $mpi -le 0 ] ; then
172      rCommand=$COMMAND      rCommand=$COMMAND
173    else    else
# Line 207  do Line 219  do
219        else nam=$xx`echo $yy | sed 's/tr_run//'` ; fi        else nam=$xx`echo $yy | sed 's/tr_run//'` ; fi
220        echo -n "Entering $xx/$yy :"        echo -n "Entering $xx/$yy :"
221        cd $xx/$yy        cd $xx/$yy
222        pwd > outp.tst_2+2.log        pwd > $LOGFILE
223        if test "x$COMMAND" = x ; then        if test "x$COMMAND" = x ; then
224          echo $SCRIPT $scrArg >> outp.tst_2+2.log ; echo ' ' >> outp.tst_2+2.log          echo $SCRIPT $scrArg >> $LOGFILE ; echo ' ' >> $LOGFILE
225          $SCRIPT $scrArg >> outp.tst_2+2.log 2>&1          $SCRIPT $scrArg >> $LOGFILE 2>&1
226          out=$?          out=$?
227        else        else
228          echo "$SCRIPT $scrArg -command \"$rCommand\"" >> outp.tst_2+2.log          echo "$SCRIPT $scrArg -command \"$rCommand\"" >> $LOGFILE
229          echo ' ' >> outp.tst_2+2.log          echo ' ' >> $LOGFILE
230          $SCRIPT $scrArg -command "$rCommand" >> outp.tst_2+2.log 2>&1          $SCRIPT $scrArg -command "$rCommand" >> $LOGFILE 2>&1
231          out=$?          out=$?
232        fi        fi
233        case $out in        case $out in
# Line 230  do Line 242  do
242        if test $out != '0' ; then        if test $out != '0' ; then
243          echo " test 2+2=4 FAIL (exit $out)"          echo " test 2+2=4 FAIL (exit $out)"
244          echo " "          echo " "
245          tail -5 outp.tst_2+2.log          tail -5 $LOGFILE
246          echo " "          echo " "
247          cp -p outp.tst_2+2.log ../../$DRESULTS/$nam.log          cp -p $LOGFILE ../../$DRESULTS/$nam.log
248        elif test $SAVELOG = 1 ; then        elif test $SAVELOG = 1 ; then
249          cp -p outp.tst_2+2.log ../../$DRESULTS/$nam.log          cp -p $LOGFILE ../../$DRESULTS/$nam.log
250        fi        fi
251        cd $here        cd $here
252      fi      fi
# Line 278  cp -p $SUMMARY tst_2+2_out.txt Line 290  cp -p $SUMMARY tst_2+2_out.txt
290  if test "x$ADDRESS" = x ; then  if test "x$ADDRESS" = x ; then
291    rm -rf $DRESULTS    rm -rf $DRESULTS
292  fi  fi
   

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.16

  ViewVC Help
Powered by ViewVC 1.1.22