Admin/isatest-makeall
author kleing
Thu, 20 Jun 2002 22:17:28 +0200
changeset 13233 5ab7bac534c9
parent 13232 8b1b5e8c4bd6
child 13236 568bc754d303
permissions -rwxr-xr-x
tuned

#!/usr/bin/env bash
#
# $Id$
# Author: Gerwin Klein, TU Muenchen
# License: GPL (GNU GENERAL PUBLIC LICENSE)
#
# DESCRIPTION: Run isatool makeall from specified distribution and settings.
#              Send email if it fails.

## global settings
LOGPREFIX=~/log

## diagnostics

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

function usage()
{
  echo
  echo "Usage: $PRG distributionpath settings1 [settings2 ...]"
  echo
  echo "  Run isatool makeall from specified distribution and settings."
  echo "  Send email if it fails."
  echo
  exit 1
}

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

## main

# argument checking

[ "$1" = "-?" ] && usage
[ "$#" -lt "2" ] && usage

DISTPREFIX=$1
shift

[ -d $DISTPREFIX ] || fail "$DISTPREFIX is not a directory."

for SETTINGS in $@; do

    [ -r $SETTINGS ] || fail "Cannot read $SETTINGS."
    

    # logfile setup

    DATE=$(date "+%d-%b-%Y")
    SHORT=${SETTINGS##*/}
    TESTLOG=$LOGPREFIX/isatest-makeall-$SHORT-$DATE-$HOSTNAME.log

    # the test

    echo ------------------- starting test --- `date` --- $HOSTNAME > $TESTLOG 2>&1

    cp $DISTPREFIX/Isabelle/etc/settings $DISTPREFIX/Isabelle/etc/settings.save-$SHORT
    cat $SETTINGS >> $DISTPREFIX/Isabelle/etc/settings
    $DISTPREFIX/Isabelle/bin/isatool makeall all >> $TESTLOG 2>&1 

    if [ $? -eq 0 ]
    then
        echo ------------------- test successfull --- `date` --- $HOSTNAME >> $TESTLOG 2>&1
        mv $DISTPREFIX/Isabelle/etc/settings-$SHORT $DISTPREFIX/Isabelle/etc/settings
        gzip -f $TESTLOG
    else
        echo ------------------- test FAILED --- `date` --- $HOSTNAME >> $TESTLOG 2>&1
        # more action here
        exit 1
    fi

done

# end