#!/usr/bin/env bash## $Id$# Author: Gerwin Klein, NICTA## Run IsaMakefile for every Doc/ subdirectory.## Relies on being run in the isatest environment on sunbroy2.# . ~/.bashrc## global settings. ~/admin/isatest-settingsDOCDIR=$HOME/DocMAXTIME=1800ISABELLE_DEVEL=$DISTPREFIX/IsabelleDATE=$(date "+%Y-%m-%d")LOG=$LOGPREFIX/isatest-doc-$DATE.logSHORT=sun-polySETTINGS=~/settings/$SHORTISATOOL=$ISABELLE_DEVEL/bin/isatoolMAIL=~/afp/release/admin/mail-attachTMP=/tmp/isatest-doc.mail.tmpwhile [ -e $TMP ]; do TMP=$TMP.x; done#PRG="$(basename "$0")"## functionsfunction usage(){ echo echo "Usage: $PRG" echo echo " Run IsaMakefile for every Doc/ subdirectory" echo exit 1}function fail(){ echo "$1" >&2 exit 2}## [ "$#" != "0" ] && usageif [ -f "$RUNNING/$SHORT.running" -o -e $ERRORLOG ]; then echo "$(date) $HOSTNAME $PRG: Skipped test. Isabelle devel version broken." >> $MASTERLOG exit 1ficat $SETTINGS >> $ISABELLE_DEVEL/etc/settingsecho "Start test at `date`" > $LOGecho >> $LOGecho "begin cvs update" >> $LOG# cvs update to newest version cd $DOCDIR || fail "could not cd to $DOCDIR"cvs -q up -A -P -d >> $LOG 2>&1 || fail "could not CVS update."echo "end cvs update" >> $LOGecho >> $LOG# run testFAIL="";cd $DOCDIRfor DIR in */; do if [ -f "$DIR/IsaMakefile" ]; then echo "Testing [$DIR]" >> $LOG ( cd $DIR ulimit -t $MAXTIME nice $ISATOOL make >> $LOG 2>&1 ) || FAIL="${FAIL}${DIR} " echo "Finished [$DIR]" >> $LOG echo >> $LOG fidoneELAPSED=$("$HOME/bin/showtime" "$SECONDS")echo >> $LOGecho "End test on `date`, elapsed time: $ELAPSED" >> $LOG# send email if there was a problemif [ "$FAIL" != "" ]; then echo >> $LOG echo "Failed sessions: ${FAIL}" >> $LOG echo "$(date) $HOSTNAME $PRG: doc test FAILED for ${FAIL}, elapsed time $ELAPSED." >> $MASTERLOG cat > $TMP <<EOFSession(s) ${FAIL} in the documentation test failed (log attached).Test ended on: $HOSTNAME, `date`.Have a nice day, isatestEOF for R in $MAILTO; do $MAIL 'doc test failed' "$R" $TMP $LOG done rm -f $TMP exit 1else echo "$(date) $HOSTNAME $PRG: doc test successful, elapsed time $ELAPSED." >> $MASTERLOGfi