Admin/isatest-doc
author wenzelm
Fri Dec 29 17:24:46 2006 +0100 (2006-12-29)
changeset 21935 4e20a5397b57
parent 16615 e665dafdd2b8
permissions -rwxr-xr-x
renamed project to subgraph, improved presentation, avoided unnecessary evaluation of predicate;
kleing@15899
     1
#!/usr/bin/env bash
kleing@15899
     2
#
kleing@15899
     3
# $Id$
kleing@15899
     4
# Author: Gerwin Klein, NICTA
kleing@15899
     5
#
kleing@15899
     6
# Run IsaMakefile for every Doc/ subdirectory.
kleing@15899
     7
#
kleing@15899
     8
# Relies on being run in the isatest environment on sunbroy2.
kleing@15899
     9
# 
kleing@15899
    10
kleing@15899
    11
. ~/.bashrc
kleing@15899
    12
kleing@16615
    13
## global settings
kleing@16615
    14
. ~/admin/isatest-settings
kleing@15899
    15
kleing@15899
    16
DOCDIR=$HOME/Doc
kleing@15899
    17
kleing@15899
    18
MAXTIME=1800
kleing@15899
    19
kleing@15899
    20
ISABELLE_DEVEL=$DISTPREFIX/Isabelle
kleing@15899
    21
DATE=$(date "+%Y-%m-%d")
kleing@15899
    22
kleing@16615
    23
LOG=$LOGPREFIX/isatest-doc-$DATE.log
kleing@15899
    24
kleing@15899
    25
SHORT=sun-poly
kleing@15899
    26
SETTINGS=~/settings/$SHORT
kleing@15899
    27
kleing@15899
    28
ISATOOL=$ISABELLE_DEVEL/bin/isatool
kleing@15899
    29
    
kleing@15899
    30
kleing@15899
    31
MAIL=~/afp/release/admin/mail-attach
kleing@15899
    32
kleing@15899
    33
TMP=/tmp/isatest-doc.mail.tmp
kleing@15899
    34
while [ -e $TMP ]; do TMP=$TMP.x; done
kleing@15899
    35
kleing@15899
    36
#
kleing@15899
    37
PRG="$(basename "$0")"
kleing@15899
    38
kleing@15899
    39
## functions
kleing@15899
    40
kleing@15899
    41
function usage()
kleing@15899
    42
{
kleing@15899
    43
  echo
kleing@15899
    44
  echo "Usage: $PRG"
kleing@15899
    45
  echo
kleing@15899
    46
  echo "  Run IsaMakefile for every Doc/ subdirectory"
kleing@15899
    47
  echo 
kleing@15899
    48
  exit 1
kleing@15899
    49
}
kleing@15899
    50
kleing@15899
    51
function fail()
kleing@15899
    52
{
kleing@15899
    53
  echo "$1" >&2
kleing@15899
    54
  exit 2
kleing@15899
    55
}
kleing@15899
    56
kleing@15899
    57
## 
kleing@15899
    58
kleing@15899
    59
[ "$#" != "0" ] && usage
kleing@15899
    60
kleing@15899
    61
if [ -f "$RUNNING/$SHORT.running" -o -e $ERRORLOG ]; then
kleing@15899
    62
  echo "$(date) $HOSTNAME $PRG: Skipped test. Isabelle devel version broken." >> $MASTERLOG
kleing@15899
    63
  exit 1
kleing@15899
    64
fi
kleing@15899
    65
cat $SETTINGS >> $ISABELLE_DEVEL/etc/settings
kleing@15899
    66
kleing@15899
    67
kleing@15899
    68
echo "Start test at `date`" > $LOG
kleing@15899
    69
echo >> $LOG
kleing@15899
    70
echo "begin cvs update" >> $LOG
kleing@15899
    71
kleing@15899
    72
# cvs update to newest version 
kleing@15899
    73
cd $DOCDIR || fail "could not cd to $DOCDIR"
kleing@15899
    74
cvs -q up -A -P -d >> $LOG 2>&1 || fail "could not CVS update."
kleing@15899
    75
kleing@15899
    76
echo "end cvs update" >> $LOG
kleing@15899
    77
echo >> $LOG
kleing@15899
    78
kleing@15899
    79
# run test
kleing@15899
    80
FAIL="";
kleing@15899
    81
kleing@15899
    82
cd $DOCDIR
kleing@15899
    83
for DIR in */; do
kleing@15899
    84
  if [ -f "$DIR/IsaMakefile" ]; then
kleing@15899
    85
    echo "Testing [$DIR]" >> $LOG
kleing@15899
    86
    (
kleing@15899
    87
      cd $DIR
kleing@15899
    88
      ulimit -t $MAXTIME 
kleing@15899
    89
      nice $ISATOOL make >> $LOG 2>&1
kleing@15899
    90
    ) || FAIL="${FAIL}${DIR} "    
kleing@15899
    91
    echo "Finished [$DIR]" >> $LOG
kleing@15899
    92
    echo >> $LOG
kleing@15899
    93
  fi
kleing@15899
    94
done
kleing@15899
    95
kleing@15899
    96
ELAPSED=$("$HOME/bin/showtime" "$SECONDS")
kleing@15899
    97
kleing@15899
    98
echo >> $LOG
kleing@15899
    99
echo "End test on `date`, elapsed time: $ELAPSED" >> $LOG
kleing@15899
   100
kleing@15899
   101
# send email if there was a problem
kleing@15899
   102
if [ "$FAIL" != "" ]; then
kleing@15899
   103
  echo >> $LOG
kleing@15899
   104
  echo "Failed sessions: ${FAIL}" >> $LOG
kleing@15899
   105
kleing@15899
   106
  echo "$(date) $HOSTNAME $PRG: doc test FAILED for ${FAIL}, elapsed time $ELAPSED." >> $MASTERLOG
kleing@15899
   107
kleing@15899
   108
  cat > $TMP <<EOF
kleing@15900
   109
Session(s) ${FAIL} in the documentation test failed (log attached).
kleing@15899
   110
Test ended on: $HOSTNAME, `date`.
kleing@15899
   111
kleing@15899
   112
Have a nice day,
kleing@15899
   113
  isatest
kleing@15899
   114
kleing@15899
   115
EOF
kleing@15899
   116
kleing@15899
   117
  for R in $MAILTO; do
kleing@15899
   118
    $MAIL 'doc test failed' "$R" $TMP $LOG
kleing@15899
   119
  done
kleing@15899
   120
kleing@15899
   121
  rm -f $TMP
kleing@15899
   122
kleing@15899
   123
  exit 1
kleing@15899
   124
else
kleing@15899
   125
  echo "$(date) $HOSTNAME $PRG: doc test successful, elapsed time $ELAPSED." >> $MASTERLOG
kleing@15899
   126
fi
kleing@15899
   127