Admin/isatest-makedist
author kleing
Fri May 09 11:54:33 2003 +0200 (2003-05-09)
changeset 13988 28c953b54cbe
parent 13962 908f6776a59b
child 13991 b289ab046d3b
permissions -rwxr-xr-x
add cleanup of old error log and test-still-running files
kleing@13231
     1
#!/usr/bin/env bash
kleing@13231
     2
#
kleing@13231
     3
# $Id$
kleing@13231
     4
# Author: Gerwin Klein, TU Muenchen
kleing@13231
     5
# License: GPL (GNU GENERAL PUBLIC LICENSE)
kleing@13231
     6
#
kleing@13231
     7
# DESCRIPTION: Build distribution and run isatest-make for lots of platforms.
kleing@13231
     8
isatest@13237
     9
# source bashrc, we're called by cron
isatest@13237
    10
. ~/.bashrc
isatest@13237
    11
kleing@13962
    12
# canoncical home for all platforms
kleing@13962
    13
HOME=/usr/stud/isatest
isatest@13237
    14
kleing@13231
    15
## global settings
isatest@13680
    16
MAILTO="kleing@in.tum.de nipkow@in.tum.de berghofe@in.tum.de schirmer@in.tum.de lp15@cam.ac.uk"
isatest@13359
    17
isatest@13359
    18
TMP=/tmp/isatest-makedist.$$
kleing@13962
    19
MAIL=$HOME/bin/pmail
isatest@13246
    20
kleing@13962
    21
LOGPREFIX=$HOME/log
isatest@13237
    22
MASTERLOG=$LOGPREFIX/isatest.log
kleing@13988
    23
ERRORLOG=$HOME/var/error.log
kleing@13988
    24
RUNNING=$HOME/var/run
kleing@13962
    25
DISTPREFIX=$HOME/isadist
kleing@13962
    26
MAKEDIST=$HOME/bin/makedist
kleing@13962
    27
MAKEALL=$HOME/bin/isatest-makeall
isatest@13234
    28
TAR=gtar
kleing@13231
    29
kleing@13233
    30
SSH="ssh -f"
kleing@13231
    31
kleing@13231
    32
## diagnostics
kleing@13231
    33
kleing@13231
    34
PRG="$(basename "$0")"
kleing@13231
    35
kleing@13231
    36
function usage()
kleing@13231
    37
{
kleing@13231
    38
  echo
kleing@13231
    39
  echo "Usage: $PRG"
kleing@13231
    40
  echo
kleing@13231
    41
  echo "   Build distribution and run isatest-make for lots of platforms."
kleing@13231
    42
  echo
kleing@13231
    43
  exit 1
kleing@13231
    44
}
kleing@13231
    45
kleing@13231
    46
function fail()
kleing@13231
    47
{
kleing@13231
    48
  echo "$1" >&2
kleing@13231
    49
  exit 2
kleing@13231
    50
}
kleing@13231
    51
kleing@13231
    52
## main
kleing@13231
    53
kleing@13988
    54
# cleanup old error log and test-still-running files
kleing@13988
    55
rm -f $ERRORLOG
kleing@13988
    56
rm -f $RUNNING/*.runnning
kleing@13988
    57
kleing@13231
    58
export DISTPREFIX
kleing@13231
    59
isatest@13431
    60
DATE=$(date "+%Y-%m-%d")
kleing@13231
    61
DISTLOG=$LOGPREFIX/isatest-makedist-$DATE.log
kleing@13231
    62
kleing@13231
    63
echo ------------------- preparing test release --- `date` --- $HOSTNAME > $DISTLOG 2>&1
kleing@13231
    64
kleing@13231
    65
echo "### cleaning up old dist directory"  >> $DISTLOG 2>&1
kleing@13231
    66
rm -rf $DISTPREFIX >> $DISTLOG 2>&1
kleing@13231
    67
isatest@13237
    68
echo "### cleaning up old isabelle-* directories" >> $DISTLOG 2>&1
kleing@13962
    69
rm -rf $HOME/isabelle-*
isatest@13237
    70
kleing@13231
    71
echo "### building distribution"  >> $DISTLOG 2>&1
kleing@13231
    72
$MAKEDIST - >> $DISTLOG 2>&1
kleing@13231
    73
kleing@13231
    74
if [ $? -ne 0 ]
kleing@13231
    75
then
kleing@13231
    76
    echo ------------------- DIST BUILD FAILED --- `date` --- $HOSTNAME >> $DISTLOG 2>&1
isatest@13237
    77
    ELAPSED=$("$HOME/bin/showtime" "$SECONDS")
isatest@13237
    78
    echo "$(date) $HOSTNAME $PRG: dist build FAILED, elapsed time $ELAPSED." >> $MASTERLOG
isatest@13246
    79
isatest@13359
    80
    echo "Could not build isabelle distribution. Log file available at" > $TMP
isatest@13359
    81
    echo "$HOSTNAME:$DISTLOG" >> $TMP
isatest@13246
    82
isatest@13359
    83
    for R in $MAILTO; do
isatest@13359
    84
	$MAIL "isabelle dist build failed" $R $TMP
isatest@13246
    85
    done
isatest@13246
    86
isatest@13359
    87
    rm $TMP
isatest@13359
    88
kleing@13231
    89
    exit 1
kleing@13231
    90
fi
kleing@13231
    91
kleing@13231
    92
cd $DISTPREFIX >> $DISTLOG 2>&1
isatest@13234
    93
$TAR xvzf `cat $DISTPREFIX/ISABELLE_DIST` >> $DISTLOG 2>&1
kleing@13231
    94
isatest@13839
    95
echo "### generating development snapshot web page" >> $DISTLOG 2>&1
kleing@13962
    96
(cd $HOME/devel-page; make)
isatest@13839
    97
kleing@13231
    98
echo ------------------- prepared test successfully --- `date` --- $HOSTNAME >> $DISTLOG 2>&1
isatest@13237
    99
gzip -f $DISTLOG
isatest@13237
   100
isatest@13237
   101
ELAPSED=$("$HOME/bin/showtime" "$SECONDS")
isatest@13237
   102
echo "$(date) $HOSTNAME $PRG: dist build successful, elapsed time $ELAPSED." >> $MASTERLOG
isatest@13237
   103
kleing@13231
   104
kleing@13231
   105
## spawn test runs
kleing@13231
   106
kleing@13962
   107
$SSH sunbroy2 "$MAKEALL $DISTPREFIX $HOME/settings/sun-poly $HOME/settings/sun-sml"
kleing@13962
   108
$SSH atbroy51 "$MAKEALL $DISTPREFIX $HOME/settings/at-poly $HOME/settings/at-sml"
kleing@13962
   109
$SSH macbroy33 "$MAKEALL $DISTPREFIX $HOME/settings/mac-poly"
kleing@13231
   110
isatest@13234
   111
## end