/[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.1 by jmc, Tue Dec 25 22:10:51 2007 UTC revision 1.2 by jmc, Wed Jan 9 22:02:03 2008 UTC
# Line 1  Line 1 
1  #!/bin/sh  #! /usr/bin/env bash
2    
3  # $Header$  # $Header$
4  # $Name$  # $Name$
# Line 12  usage() Line 12  usage()
12          echo "  -help         : print usage"          echo "  -help         : print usage"
13          echo "  -t   LIST_EXP : only check experiments in LIST_EXP"          echo "  -t   LIST_EXP : only check experiments in LIST_EXP"
14          echo "  -skd LIST_EXP : skip experiments in LIST_EXP"          echo "  -skd LIST_EXP : skip experiments in LIST_EXP"
15          echo "  (-o) STRING   : used to build output directory name"          echo "  -o     STRING : used to build output directory name"
16          echo "                      (DEF=\"hostname\")"          echo "                      (DEF=\"hostname\")"
17          echo "  (-a) STRING   : email address to send output to"          echo "  -a,-A  STRING : email address to send output to"
18          echo "                      (DEF=\"\" no email is sent)"          echo "                      (DEF=\"\" no email is sent)"
19            echo "                      (-A: + save each log file)"
20          echo "  -clean        : clean output & reset"          echo "  -clean        : clean output & reset"
21          exit          exit
22  }  }
# Line 24  CLEAN=0 Line 25  CLEAN=0
25  TESTDIRS=  TESTDIRS=
26  SKIPDIRS=  SKIPDIRS=
27  OUTDIR=`hostname`  OUTDIR=`hostname`
28    SAVELOG=0
29  ADDRESS=  ADDRESS=
30  SCRIPT='../tools/tst_2+2'  SCRIPT='../tools/tst_2+2'
31  MPACK="../tools/mpack-1.6/mpack"  MPACK="../tools/mpack-1.6/mpack"
# Line 41  do Line 43  do
43        -t    ) yy=TESTDIRS ;;        -t    ) yy=TESTDIRS ;;
44        -skd  ) yy=SKIPDIRS ;;        -skd  ) yy=SKIPDIRS ;;
45        -a    ) yy=ADDRESS ;;        -a    ) yy=ADDRESS ;;
46          -A    ) yy=ADDRESS ; SAVELOG=1 ;;
47        -o    ) yy=OUTDIR ;;        -o    ) yy=OUTDIR ;;
48          *) echo "Error: unrecognized option: "$xx ; usage ; exit ;;          *) echo "Error: unrecognized option: "$xx ; usage ; exit ;;
49        esac        esac
# Line 48  do Line 51  do
51  done  done
52  #------------------------  #------------------------
53    
54  if test "x$TESTDIRS" = x  if test "x$TESTDIRS" = x ; then TESTDIRS=`ls ` ; fi
 then  
  TESTDIRS=`ls `  
 fi  
55  LIST=""  LIST=""
56  for xx in $TESTDIRS  for xx in $TESTDIRS
57  do  do
58    yy=`echo $SKIPDIRS | grep -c $xx`    yy=`echo $SKIPDIRS | grep -c $xx`
59    if test $yy = 0 ; then    if test $yy = 0 ; then
60      if test -f $xx/results/output.txt      if test -f $xx/results/output.txt ; then
     then  
61         LIST=${LIST}" "$xx         LIST=${LIST}" "$xx
62  #   else  #   else
63  #      echo ""; echo -n " -- skip \"$xx\" (not a directory !)"  #      echo ""; echo -n " -- skip \"$xx\" (not a directory !)"
# Line 71  done Line 70  done
70  if test -x $SCRIPT ; then  if test -x $SCRIPT ; then
71   echo "run script '$SCRIPT' for experiment in:"   echo "run script '$SCRIPT' for experiment in:"
72   echo " $LIST"   echo " $LIST"
73   yy=`echo $SCRIPT | grep -c '^\/'`   yy=`echo $SCRIPT | grep -c '^\/'`
74   if test $yy = 0 ; then SCRIPT="../../$SCRIPT" ; fi   if test $yy = 0 ; then SCRIPT="../../$SCRIPT" ; fi
75  else  else
76   echo "ERROR: script '$SCRIPT' not found or not executable"   echo "ERROR: script '$SCRIPT' not found or not executable"
# Line 86  if test $CLEAN = 1 ; then Line 85  if test $CLEAN = 1 ; then
85    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' )`
86    for yy in $listD    for yy in $listD
87    do    do
88      if test -r $xx/$yy/data.tst      if test -r $xx/$yy/data.tst ; then
     then  
89        echo "clean dir:" $xx/$yy        echo "clean dir:" $xx/$yy
90        cd $xx/$yy        cd $xx/$yy
91        echo ' ' >> outp.tst_2+2.log        echo ' ' >> outp.tst_2+2.log
92        echo $SCRIPT 4 >> outp.tst_2+2.log        echo $SCRIPT 4 >> outp.tst_2+2.log
93        $SCRIPT 4 >> outp.tst_2+2.log 2>&1        $SCRIPT 4 >> outp.tst_2+2.log 2>&1
# Line 136  do Line 134  do
134    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' )`
135    for yy in $listD    for yy in $listD
136    do    do
137      if test -f $xx/$yy/output.txt      if test -f $xx/$yy/output.txt ; then
     then  
138        if test "x$OPTFILE" = x -a -f $xx/build/Makefile ; then        if test "x$OPTFILE" = x -a -f $xx/build/Makefile ; then
139          comm=`grep '^# OPTFILE=' $xx/build/Makefile 2>/dev/null | head -1 | sed 's/^# //'`          comm=`grep '^# OPTFILE=' $xx/build/Makefile 2>/dev/null | head -1 | sed 's/^# //'`
140          echo "from '$xx/build/Makefile', extract:" > $DRESULTS/genmake_state          echo "from '$xx/build/Makefile', extract:" > $DRESULTS/genmake_state
141          echo $comm >> $DRESULTS/genmake_state          echo $comm >> $DRESULTS/genmake_state
142          eval $comm          eval $comm
143        fi        fi
144        if test $yy = 'run' ; then nam=$xx        if test $yy = 'run' ; then nam=$xx
145        else nam=$xx`echo $yy | sed 's/tr_run//'` ; fi        else nam=$xx`echo $yy | sed 's/tr_run//'` ; fi
146        echo -n "Entering $xx/$yy :"        echo -n "Entering $xx/$yy :"
147        cd $xx/$yy        cd $xx/$yy
148        echo $SCRIPT All > outp.tst_2+2.log ; echo ' ' >> outp.tst_2+2.log        pwd > outp.tst_2+2.log
149          echo $SCRIPT All >> outp.tst_2+2.log ; echo ' ' >> outp.tst_2+2.log
150        $SCRIPT All >> outp.tst_2+2.log 2>&1        $SCRIPT All >> outp.tst_2+2.log 2>&1
151        out=$?        out=$?
152        case $out in        case $out in
# Line 160  do Line 158  do
158         1 ) echo "Y N N N FAIL ($out) - $nam" >> ../../$SUMMARY ;;         1 ) echo "Y N N N FAIL ($out) - $nam" >> ../../$SUMMARY ;;
159         * ) echo "N N N N FAIL ($out) - $nam" >> ../../$SUMMARY ;;         * ) echo "N N N N FAIL ($out) - $nam" >> ../../$SUMMARY ;;
160        esac        esac
161        if test $out != '0'        if test $out != '0' ; then
       then  
162          echo " test 2+2=4 FAIL (exit $out)"          echo " test 2+2=4 FAIL (exit $out)"
163          echo " "          echo " "
164          tail -5 outp.tst_2+2.log          tail -5 outp.tst_2+2.log
165          echo " "          echo " "
166            cp -p outp.tst_2+2.log ../../$DRESULTS/$nam.log
167          elif test $SAVELOG = 1 ; then
168            cp -p outp.tst_2+2.log ../../$DRESULTS/$nam.log
169        fi        fi
170        cd $here        cd $here
171      fi      fi

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.22