/[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.10 by jmc, Fri Jan 21 02:18:46 2011 UTC revision 1.15 by jmc, Sat Aug 18 18:59:14 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 77  do Line 78  do
78    fi    fi
79  done  done
80    
 if test -x $SCRIPT ; then  
  echo "run script '$SCRIPT' for experiment in:"  
  echo " $LIST"  
  yy=`echo $SCRIPT | grep -c '^\/'`  
  if test $yy = 0 ; then SCRIPT="../../$SCRIPT" ; fi  
 else  
  echo "ERROR: script '$SCRIPT' not found or not executable"  
  exit  
 fi  
 echo ""  
81  #------------------------  #------------------------
   
82  if test $CLEAN = 1 ; then  if test $CLEAN = 1 ; then
83     echo "clean output from script '$SCRIPT' for experiment in:"
84     echo " $LIST"
85     echo ""
86   for xx in $LIST   for xx in $LIST
87   do   do
88    listD='run '`(cd $xx/results ; ls output.*.txt 2> /dev/null | sed 's/^output\./tr_run./g' | sed 's/\.txt$//g' )`    listD='run '`(cd $xx/results ; ls output.*.txt 2> /dev/null | sed 's/^output\./tr_run./g' | sed 's/\.txt$//g' )`
# Line 98  if test $CLEAN = 1 ; then Line 91  if test $CLEAN = 1 ; then
91      if test -r $xx/$yy/data.tst ; then      if test -r $xx/$yy/data.tst ; then
92        echo "clean dir:" $xx/$yy        echo "clean dir:" $xx/$yy
93        cd $xx/$yy        cd $xx/$yy
94        echo ' ' >> outp.tst_2+2.log        echo ' ' >> $LOGFILE
95        echo $SCRIPT 4 >> outp.tst_2+2.log        echo $SCRIPT 4 >> $LOGFILE
96        $SCRIPT 4 >> outp.tst_2+2.log 2>&1        $SCRIPT 4 >> $LOGFILE 2>&1
97        cd $here        cd $here
98      fi      fi
99    done    done
100   done   done
101   exit   exit
102  fi  fi
103    if test -x $SCRIPT ; then
104     echo "run script '$SCRIPT' for experiment in:"
105     echo " $LIST"
106     echo ""
107     yy=`echo $SCRIPT | grep -c '^\/'`
108     if test $yy = 0 ; then SCRIPT="../../$SCRIPT" ; fi
109    else
110     echo "ERROR: script '$SCRIPT' not found or not executable"
111     exit
112    fi
113    
114  #------------------------  #------------------------
115  #  Create a uniquely named directory to store results  #  Create a uniquely named directory to store results
116  CMDLINE=$0  CMDLINE=$0
# Line 115  for xx in "$@" ; do nw=`echo $xx | wc -w Line 119  for xx in "$@" ; do nw=`echo $xx | wc -w
119                          else CMDLINE="$CMDLINE '$xx'" ; fi                          else CMDLINE="$CMDLINE '$xx'" ; fi
120  done  done
121  #for xx in "$@" ; do CMDLINE="$CMDLINE '$xx'" ; done  #for xx in "$@" ; do CMDLINE="$CMDLINE '$xx'" ; done
122  DATE=`date +%Y%m%d`  DATE=''
123    if test -f tr_out.txt ; then
124    #  try to use the date corresponding to 'Start time:' in file "tr_out.txt" :
125      sTime=`grep '^Start time:  ' tr_out.txt 2>/dev/null | sed 's/Start time:  //'`
126      if test "x$sTime" != x ; then DATE=`date -d "$sTime" "+%Y%m%d" 2>/dev/null` ; fi
127    fi
128    #  otherwise, use current date:
129    if test "x$DATE" = x ; then DATE=`date +%Y%m%d`; fi
130  BASE="rs_"$OUTDIR"_"$DATE"_"  BASE="rs_"$OUTDIR"_"$DATE"_"
131  xx=0  xx=0
132  DRESULTS="$BASE$xx"  DRESULTS="$BASE$xx"
# Line 137  date  >> $SUMMARY Line 148  date  >> $SUMMARY
148  echo 'run:' $CMDLINE >> $SUMMARY  echo 'run:' $CMDLINE >> $SUMMARY
149  if test -f tr_out.txt ; then  if test -f tr_out.txt ; then
150   echo ' using output from:' >> $SUMMARY   echo ' using output from:' >> $SUMMARY
151   sed -n '2,/OPTFILE/ p' tr_out.txt >> $SUMMARY   sed -n '2,/^  OPTFILE=/ p' tr_out.txt >> $SUMMARY
152   echo >> $SUMMARY   echo >> $SUMMARY
153  fi  fi
154  echo  'test 2+2=4 summary :' >> $SUMMARY  echo  'test 2+2=4 summary :' >> $SUMMARY
# Line 155  fi Line 166  fi
166    
167  for xx in $LIST  for xx in $LIST
168  do  do
169    echo ==============================================================================    echo '------------------------------------------------------------------------------'
170    if [ $mpi -le 0 ] ; then    if [ $mpi -le 0 ] ; then
171      rCommand=$COMMAND      rCommand=$COMMAND
172    else    else
# Line 207  do Line 218  do
218        else nam=$xx`echo $yy | sed 's/tr_run//'` ; fi        else nam=$xx`echo $yy | sed 's/tr_run//'` ; fi
219        echo -n "Entering $xx/$yy :"        echo -n "Entering $xx/$yy :"
220        cd $xx/$yy        cd $xx/$yy
221        pwd > outp.tst_2+2.log        pwd > $LOGFILE
222        if test "x$COMMAND" = x ; then        if test "x$COMMAND" = x ; then
223          echo $SCRIPT $scrArg >> outp.tst_2+2.log ; echo ' ' >> outp.tst_2+2.log          echo $SCRIPT $scrArg >> $LOGFILE ; echo ' ' >> $LOGFILE
224          $SCRIPT $scrArg >> outp.tst_2+2.log 2>&1          $SCRIPT $scrArg >> $LOGFILE 2>&1
225          out=$?          out=$?
226        else        else
227          echo "$SCRIPT $scrArg -command \"$rCommand\"" >> outp.tst_2+2.log          echo "$SCRIPT $scrArg -command \"$rCommand\"" >> $LOGFILE
228          echo ' ' >> outp.tst_2+2.log          echo ' ' >> $LOGFILE
229          $SCRIPT $scrArg -command "$rCommand" >> outp.tst_2+2.log 2>&1          $SCRIPT $scrArg -command "$rCommand" >> $LOGFILE 2>&1
230          out=$?          out=$?
231        fi        fi
232        case $out in        case $out in
# Line 230  do Line 241  do
241        if test $out != '0' ; then        if test $out != '0' ; then
242          echo " test 2+2=4 FAIL (exit $out)"          echo " test 2+2=4 FAIL (exit $out)"
243          echo " "          echo " "
244          tail -5 outp.tst_2+2.log          tail -5 $LOGFILE
245          echo " "          echo " "
246          cp -p outp.tst_2+2.log ../../$DRESULTS/$nam.log          cp -p $LOGFILE ../../$DRESULTS/$nam.log
247        elif test $SAVELOG = 1 ; then        elif test $SAVELOG = 1 ; then
248          cp -p outp.tst_2+2.log ../../$DRESULTS/$nam.log          cp -p $LOGFILE ../../$DRESULTS/$nam.log
249        fi        fi
250        cd $here        cd $here
251      fi      fi
# Line 278  cp -p $SUMMARY tst_2+2_out.txt Line 289  cp -p $SUMMARY tst_2+2_out.txt
289  if test "x$ADDRESS" = x ; then  if test "x$ADDRESS" = x ; then
290    rm -rf $DRESULTS    rm -rf $DRESULTS
291  fi  fi
   

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.15

  ViewVC Help
Powered by ViewVC 1.1.22