Home | History | Annotate | Line # | Download | only in examples
      1 #! /bin/sh
      2 
      3 # Run one or more regression hunts
      4 #
      5 # The file specified as the single argument is a queue of regression
      6 # hunts and/or lists of patches to test.  Each entry in the file is
      7 # "hunt" or "test" followed by a bugid for which there is a config
      8 # file and other required files (patch list and test source file).
      9 # Each line of the file is removed as it is processed, and new ones
     10 # can be added while the script is still running.
     11 
     12 #set -ex
     13 
     14 if [ $# != 1 ]; then
     15   echo "usage: $0 testfile"
     16   exit 1
     17 fi
     18 
     19 REGFILE=$1
     20 TMPFILE=testall.tmp
     21 
     22 if [ ! -f $REGFILE ]; then
     23   echo "$0: file $REGFILE does not exist"
     24   exit 1
     25 fi
     26 
     27 RETURN_FOR_TEST=return
     28 RETURN_FOR_TEST=true
     29 
     30 . ../gcc-svn-env
     31 
     32 hunt() {
     33   id=$1
     34 
     35   echo regression hunt for $id
     36   $RETURN_FOR_TEST
     37   $REG_CLEANUP
     38   reg-hunt $id.config >> $id.log 2>&1
     39   tail -n 1 $id.log
     40   #tail -n 1 $id.log | mutt -s "reghunt for $id finished" janis187
     41 }
     42 
     43 testit() {
     44   id=$1
     45 
     46   echo testing specific dates for $id
     47   $RETURN_FOR_TEST
     48   $REG_CLEANUP
     49   reg-test $id.config >> $id.log 2>&1
     50   #mutt -s "reg-test for $id finished" janis187 < /dev/null
     51 }
     52 
     53 rm -f $REG_STOP
     54 
     55 while
     56   read WHICH ID < $REGFILE
     57 do
     58   if [ -f $REG_STOP ]; then
     59     echo "$REG_STOP detected"
     60     rm -f $REG_STOP
     61     exit 1
     62   fi
     63 
     64   sed 1d < $REGFILE > $TMPFILE
     65   mv $TMPFILE $REGFILE
     66 
     67   case $WHICH in
     68     hunt)  hunt $ID;;
     69     test)  testit $ID;;
     70     *)     echo "unknown action $WHICH, skipping $ID";;
     71   esac
     72   echo
     73 done
     74