Admin/isatest-makedist
author isatest
Mon, 24 Jun 2002 16:33:43 +0200
changeset 13246 e51efc2029e9
parent 13237 493d61afa731
child 13359 982827aacb39
permissions -rwxr-xr-x
email sending

#!/usr/bin/env bash
#
# $Id$
# Author: Gerwin Klein, TU Muenchen
# License: GPL (GNU GENERAL PUBLIC LICENSE)
#
# DESCRIPTION: Build distribution and run isatest-make for lots of platforms.

# source bashrc, we're called by cron
. ~/.bashrc


## global settings
MAILTO="kleing@in.tum.de test@jflex.de"

LOGPREFIX=~/log
MASTERLOG=$LOGPREFIX/isatest.log
DISTPREFIX=~/isadist
MAKEDIST=~/bin/makedist
MAKEALL=~/bin/isatest-makeall
TAR=gtar

SUN=sunbroy2
AT=atbroy37

SSH="ssh -f"

## diagnostics

PRG="$(basename "$0")"

function usage()
{
  echo
  echo "Usage: $PRG"
  echo
  echo "   Build distribution and run isatest-make for lots of platforms."
  echo
  exit 1
}

function fail()
{
  echo "$1" >&2
  exit 2
}

## main

export DISTPREFIX

DATE=$(date "+%d-%b-%Y")
DISTLOG=$LOGPREFIX/isatest-makedist-$DATE.log

echo ------------------- preparing test release --- `date` --- $HOSTNAME > $DISTLOG 2>&1

echo "### cleaning up old dist directory"  >> $DISTLOG 2>&1
rm -rf $DISTPREFIX >> $DISTLOG 2>&1

echo "### cleaning up old isabelle-* directories" >> $DISTLOG 2>&1
rm -rf ~/isabelle-*

echo "### building distribution"  >> $DISTLOG 2>&1
$MAKEDIST - >> $DISTLOG 2>&1

if [ $? -ne 0 ]
then
    echo ------------------- DIST BUILD FAILED --- `date` --- $HOSTNAME >> $DISTLOG 2>&1
    ELAPSED=$("$HOME/bin/showtime" "$SECONDS")
    echo "$(date) $HOSTNAME $PRG: dist build FAILED, elapsed time $ELAPSED." >> $MASTERLOG

    for R in $MAILTO; do 
        mail -t $R <<EOM
Subject: isabelle dist build failed

Could not build isabelle distribution. Log file available at

$HOSTNAME:$DISTLOG
EOM
    done

    # more action here
    exit 1
fi

cd $DISTPREFIX >> $DISTLOG 2>&1
$TAR xvzf `cat $DISTPREFIX/ISABELLE_DIST` >> $DISTLOG 2>&1

echo ------------------- prepared test successfully --- `date` --- $HOSTNAME >> $DISTLOG 2>&1
gzip -f $DISTLOG

ELAPSED=$("$HOME/bin/showtime" "$SECONDS")
echo "$(date) $HOSTNAME $PRG: dist build successful, elapsed time $ELAPSED." >> $MASTERLOG


## spawn test runs

# run tests in parallel on multiprocessor sun 
$SSH $SUN "$MAKEALL $DISTPREFIX ~/settings/sun-poly ~/settings/sun-sml"
# $SSH $SUN "$MAKEALL $DISTPREFIX ~/settings/sun-sml"

# run tests sequentially on x86
$SSH $AT "$MAKEALL $DISTPREFIX ~/settings/at-poly ~/settings/at-sml"

## end