Admin/isatest-makedist
author kleing
Mon Jun 21 10:25:57 2004 +0200 (2004-06-21)
changeset 14981 e73f8140af78
parent 14170 edd5a2ea3807
child 15438 dfc7d2a824d6
permissions -rwxr-xr-x
Merged in license change from Isabelle2004
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
#
kleing@13231
     6
# DESCRIPTION: Build distribution and run isatest-make for lots of platforms.
kleing@13231
     7
isatest@13237
     8
# source bashrc, we're called by cron
isatest@13237
     9
. ~/.bashrc
isatest@13237
    10
kleing@13962
    11
# canoncical home for all platforms
kleing@13962
    12
HOME=/usr/stud/isatest
isatest@13237
    13
kleing@13231
    14
## global settings
skalberg@14170
    15
MAILTO="kleing@in.tum.de nipkow@in.tum.de berghofe@in.tum.de schirmer@in.tum.de lp15@cam.ac.uk skalberg@in.tum.de"
isatest@13359
    16
isatest@13359
    17
TMP=/tmp/isatest-makedist.$$
kleing@13962
    18
MAIL=$HOME/bin/pmail
isatest@13246
    19
kleing@13962
    20
LOGPREFIX=$HOME/log
isatest@13237
    21
MASTERLOG=$LOGPREFIX/isatest.log
kleing@14037
    22
ERRORDIR=$HOME/var
kleing@14037
    23
ERRORLOG=$ERRORDIR/error.log
kleing@13991
    24
RUNNING=$HOME/var/running
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@14037
    56
rm -f $ERRORDIR/isatest-*.log
kleing@13988
    57
rm -f $RUNNING/*.runnning
kleing@13988
    58
kleing@13231
    59
export DISTPREFIX
kleing@13231
    60
isatest@13431
    61
DATE=$(date "+%Y-%m-%d")
kleing@13231
    62
DISTLOG=$LOGPREFIX/isatest-makedist-$DATE.log
kleing@13231
    63
kleing@13231
    64
echo ------------------- preparing test release --- `date` --- $HOSTNAME > $DISTLOG 2>&1
kleing@13231
    65
kleing@13231
    66
echo "### cleaning up old dist directory"  >> $DISTLOG 2>&1
kleing@13231
    67
rm -rf $DISTPREFIX >> $DISTLOG 2>&1
kleing@13231
    68
isatest@13237
    69
echo "### cleaning up old isabelle-* directories" >> $DISTLOG 2>&1
kleing@13962
    70
rm -rf $HOME/isabelle-*
isatest@13237
    71
kleing@13231
    72
echo "### building distribution"  >> $DISTLOG 2>&1
kleing@13231
    73
$MAKEDIST - >> $DISTLOG 2>&1
kleing@13231
    74
kleing@13231
    75
if [ $? -ne 0 ]
kleing@13231
    76
then
kleing@13231
    77
    echo ------------------- DIST BUILD FAILED --- `date` --- $HOSTNAME >> $DISTLOG 2>&1
isatest@13237
    78
    ELAPSED=$("$HOME/bin/showtime" "$SECONDS")
isatest@13237
    79
    echo "$(date) $HOSTNAME $PRG: dist build FAILED, elapsed time $ELAPSED." >> $MASTERLOG
isatest@13246
    80
isatest@13359
    81
    echo "Could not build isabelle distribution. Log file available at" > $TMP
isatest@13359
    82
    echo "$HOSTNAME:$DISTLOG" >> $TMP
isatest@13246
    83
isatest@13359
    84
    for R in $MAILTO; do
kleing@14037
    85
        $MAIL "isabelle dist build failed" $R $TMP
isatest@13246
    86
    done
isatest@13246
    87
isatest@13359
    88
    rm $TMP
isatest@13359
    89
kleing@13231
    90
    exit 1
kleing@13231
    91
fi
kleing@13231
    92
kleing@13231
    93
cd $DISTPREFIX >> $DISTLOG 2>&1
isatest@13234
    94
$TAR xvzf `cat $DISTPREFIX/ISABELLE_DIST` >> $DISTLOG 2>&1
kleing@13231
    95
kleing@13231
    96
echo ------------------- prepared test successfully --- `date` --- $HOSTNAME >> $DISTLOG 2>&1
isatest@13237
    97
gzip -f $DISTLOG
isatest@13237
    98
isatest@13237
    99
ELAPSED=$("$HOME/bin/showtime" "$SECONDS")
isatest@13237
   100
echo "$(date) $HOSTNAME $PRG: dist build successful, elapsed time $ELAPSED." >> $MASTERLOG
isatest@13237
   101
kleing@13231
   102
kleing@13231
   103
## spawn test runs
kleing@13231
   104
kleing@13962
   105
$SSH sunbroy2 "$MAKEALL $DISTPREFIX $HOME/settings/sun-poly $HOME/settings/sun-sml"
kleing@14032
   106
# give test some time to copy settings and start
kleing@14032
   107
sleep 5
kleing@13962
   108
$SSH atbroy51 "$MAKEALL $DISTPREFIX $HOME/settings/at-poly $HOME/settings/at-sml"
kleing@14032
   109
# give test some time to copy settings and start
kleing@14032
   110
sleep 5
kleing@13962
   111
$SSH macbroy33 "$MAKEALL $DISTPREFIX $HOME/settings/mac-poly"
kleing@13231
   112
isatest@13234
   113
## end