Admin/isatest-makedist
author paulson
Mon Jul 21 13:02:07 2003 +0200 (2003-07-21)
changeset 14120 3a73850c6c7d
parent 14037 3b7f3eec9684
child 14170 edd5a2ea3807
permissions -rwxr-xr-x
Tidied some examples
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@14037
    23
ERRORDIR=$HOME/var
kleing@14037
    24
ERRORLOG=$ERRORDIR/error.log
kleing@13991
    25
RUNNING=$HOME/var/running
kleing@13962
    26
DISTPREFIX=$HOME/isadist
kleing@13962
    27
MAKEDIST=$HOME/bin/makedist
kleing@13962
    28
MAKEALL=$HOME/bin/isatest-makeall
isatest@13234
    29
TAR=gtar
kleing@13231
    30
kleing@13233
    31
SSH="ssh -f"
kleing@13231
    32
kleing@13231
    33
## diagnostics
kleing@13231
    34
kleing@13231
    35
PRG="$(basename "$0")"
kleing@13231
    36
kleing@13231
    37
function usage()
kleing@13231
    38
{
kleing@13231
    39
  echo
kleing@13231
    40
  echo "Usage: $PRG"
kleing@13231
    41
  echo
kleing@13231
    42
  echo "   Build distribution and run isatest-make for lots of platforms."
kleing@13231
    43
  echo
kleing@13231
    44
  exit 1
kleing@13231
    45
}
kleing@13231
    46
kleing@13231
    47
function fail()
kleing@13231
    48
{
kleing@13231
    49
  echo "$1" >&2
kleing@13231
    50
  exit 2
kleing@13231
    51
}
kleing@13231
    52
kleing@13231
    53
## main
kleing@13231
    54
kleing@13988
    55
# cleanup old error log and test-still-running files
kleing@13988
    56
rm -f $ERRORLOG
kleing@14037
    57
rm -f $ERRORDIR/isatest-*.log
kleing@13988
    58
rm -f $RUNNING/*.runnning
kleing@13988
    59
kleing@13231
    60
export DISTPREFIX
kleing@13231
    61
isatest@13431
    62
DATE=$(date "+%Y-%m-%d")
kleing@13231
    63
DISTLOG=$LOGPREFIX/isatest-makedist-$DATE.log
kleing@13231
    64
kleing@13231
    65
echo ------------------- preparing test release --- `date` --- $HOSTNAME > $DISTLOG 2>&1
kleing@13231
    66
kleing@13231
    67
echo "### cleaning up old dist directory"  >> $DISTLOG 2>&1
kleing@13231
    68
rm -rf $DISTPREFIX >> $DISTLOG 2>&1
kleing@13231
    69
isatest@13237
    70
echo "### cleaning up old isabelle-* directories" >> $DISTLOG 2>&1
kleing@13962
    71
rm -rf $HOME/isabelle-*
isatest@13237
    72
kleing@13231
    73
echo "### building distribution"  >> $DISTLOG 2>&1
kleing@13231
    74
$MAKEDIST - >> $DISTLOG 2>&1
kleing@13231
    75
kleing@13231
    76
if [ $? -ne 0 ]
kleing@13231
    77
then
kleing@13231
    78
    echo ------------------- DIST BUILD FAILED --- `date` --- $HOSTNAME >> $DISTLOG 2>&1
isatest@13237
    79
    ELAPSED=$("$HOME/bin/showtime" "$SECONDS")
isatest@13237
    80
    echo "$(date) $HOSTNAME $PRG: dist build FAILED, elapsed time $ELAPSED." >> $MASTERLOG
isatest@13246
    81
isatest@13359
    82
    echo "Could not build isabelle distribution. Log file available at" > $TMP
isatest@13359
    83
    echo "$HOSTNAME:$DISTLOG" >> $TMP
isatest@13246
    84
isatest@13359
    85
    for R in $MAILTO; do
kleing@14037
    86
        $MAIL "isabelle dist build failed" $R $TMP
isatest@13246
    87
    done
isatest@13246
    88
isatest@13359
    89
    rm $TMP
isatest@13359
    90
kleing@13231
    91
    exit 1
kleing@13231
    92
fi
kleing@13231
    93
kleing@13231
    94
cd $DISTPREFIX >> $DISTLOG 2>&1
isatest@13234
    95
$TAR xvzf `cat $DISTPREFIX/ISABELLE_DIST` >> $DISTLOG 2>&1
kleing@13231
    96
kleing@13231
    97
echo ------------------- prepared test successfully --- `date` --- $HOSTNAME >> $DISTLOG 2>&1
isatest@13237
    98
gzip -f $DISTLOG
isatest@13237
    99
isatest@13237
   100
ELAPSED=$("$HOME/bin/showtime" "$SECONDS")
isatest@13237
   101
echo "$(date) $HOSTNAME $PRG: dist build successful, elapsed time $ELAPSED." >> $MASTERLOG
isatest@13237
   102
kleing@13231
   103
kleing@13231
   104
## spawn test runs
kleing@13231
   105
kleing@13962
   106
$SSH sunbroy2 "$MAKEALL $DISTPREFIX $HOME/settings/sun-poly $HOME/settings/sun-sml"
kleing@14032
   107
# give test some time to copy settings and start
kleing@14032
   108
sleep 5
kleing@13962
   109
$SSH atbroy51 "$MAKEALL $DISTPREFIX $HOME/settings/at-poly $HOME/settings/at-sml"
kleing@14032
   110
# give test some time to copy settings and start
kleing@14032
   111
sleep 5
kleing@13962
   112
$SSH macbroy33 "$MAKEALL $DISTPREFIX $HOME/settings/mac-poly"
kleing@13231
   113
isatest@13234
   114
## end