Admin/isatest-makeall
author isatest
Tue, 30 Jul 2002 10:29:34 +0200
changeset 13432 470daa444967
parent 13359 982827aacb39
child 13838 fe83f2231767
permissions -rwxr-xr-x
- changed date format for proper lexicographical ordering - send tail of log in email
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
     1
#!/usr/bin/env bash
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
     2
#
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
     3
# $Id$
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
     4
# Author: Gerwin Klein, TU Muenchen
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
     5
# License: GPL (GNU GENERAL PUBLIC LICENSE)
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
     6
#
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
     7
# DESCRIPTION: Run isatool makeall from specified distribution and settings.
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
     8
#              Send email if it fails.
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
     9
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    10
## global settings
13359
982827aacb39 mail address update
isatest
parents: 13320
diff changeset
    11
MAILTO="kleing@in.tum.de nipkow@in.tum.de wenzelm@in.tum.de berghofe@in.tum.de schirmer@in.tum.de lp15@cam.ac.uk"
13246
e51efc2029e9 email sending
isatest
parents: 13236
diff changeset
    12
13232
kleing
parents: 13231
diff changeset
    13
LOGPREFIX=~/log
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    14
13236
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
    15
MASTERLOG=$LOGPREFIX/isatest.log
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
    16
13320
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
    17
TMP=/tmp/isatest-makeall.$$
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
    18
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
    19
MAIL=~/bin/pmail
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
    20
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    21
## diagnostics
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    22
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    23
PRG="$(basename "$0")"
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    24
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    25
function usage()
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    26
{
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    27
  echo
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    28
  echo "Usage: $PRG distributionpath settings1 [settings2 ...]"
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    29
  echo
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    30
  echo "  Run isatool makeall from specified distribution and settings."
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    31
  echo "  Send email if it fails."
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    32
  echo
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    33
  exit 1
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    34
}
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    35
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    36
function fail()
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    37
{
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    38
  echo "$1" >&2
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    39
  exit 2
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    40
}
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    41
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    42
## main
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    43
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    44
# argument checking
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    45
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    46
[ "$1" = "-?" ] && usage
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    47
[ "$#" -lt "2" ] && usage
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    48
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    49
DISTPREFIX=$1
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    50
shift
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    51
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    52
[ -d $DISTPREFIX ] || fail "$DISTPREFIX is not a directory."
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    53
13320
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
    54
LOGS=""
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
    55
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    56
for SETTINGS in $@; do
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    57
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    58
    [ -r $SETTINGS ] || fail "Cannot read $SETTINGS."
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    59
    
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    60
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    61
    # logfile setup
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    62
13432
470daa444967 - changed date format for proper lexicographical ordering
isatest
parents: 13359
diff changeset
    63
    DATE=$(date "+%Y-%m-%d")
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    64
    SHORT=${SETTINGS##*/}
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    65
    TESTLOG=$LOGPREFIX/isatest-makeall-$SHORT-$DATE-$HOSTNAME.log
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    66
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    67
    # the test
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    68
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    69
    echo ------------------- starting test --- `date` --- $HOSTNAME > $TESTLOG 2>&1
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    70
13233
kleing
parents: 13232
diff changeset
    71
    cat $SETTINGS >> $DISTPREFIX/Isabelle/etc/settings
13320
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
    72
    nice $DISTPREFIX/Isabelle/bin/isatool makeall -j 2 all >> $TESTLOG 2>&1 
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    73
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    74
    if [ $? -eq 0 ]
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    75
    then
13236
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
    76
        echo ------------------- test successful --- `date` --- $HOSTNAME >> $TESTLOG 2>&1
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    77
        gzip -f $TESTLOG
13246
e51efc2029e9 email sending
isatest
parents: 13236
diff changeset
    78
	rm -rf ~/isabelle-$SHORT
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    79
    else
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    80
        echo ------------------- test FAILED --- `date` --- $HOSTNAME >> $TESTLOG 2>&1
13236
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
    81
	FAIL="$FAIL$SHORT "
13432
470daa444967 - changed date format for proper lexicographical ordering
isatest
parents: 13359
diff changeset
    82
	LOGS="${LOGS}$TESTLOG "
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    83
    fi
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    84
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    85
done
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    86
13236
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
    87
ELAPSED=$("$HOME/bin/showtime" "$SECONDS")
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
    88
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
    89
if [ "$FAIL" != "" ]; then
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
    90
	echo "$(date) $HOSTNAME $PRG: targets ${FAIL}FAILED, elapsed time $ELAPSED." >> $MASTERLOG
13320
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
    91
	
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
    92
	echo "Test for platform(s) ${FAIL}failed. Log file(s) available at" > $TMP
13432
470daa444967 - changed date format for proper lexicographical ordering
isatest
parents: 13359
diff changeset
    93
	for L in $LOGS; do 
470daa444967 - changed date format for proper lexicographical ordering
isatest
parents: 13359
diff changeset
    94
		echo "$HOSTNAME:$L" >> $TMP 
470daa444967 - changed date format for proper lexicographical ordering
isatest
parents: 13359
diff changeset
    95
		echo "[...]" >> $TMP
470daa444967 - changed date format for proper lexicographical ordering
isatest
parents: 13359
diff changeset
    96
		tail -3 $L >> $TMP
470daa444967 - changed date format for proper lexicographical ordering
isatest
parents: 13359
diff changeset
    97
		echo >> $TMP
470daa444967 - changed date format for proper lexicographical ordering
isatest
parents: 13359
diff changeset
    98
	done
470daa444967 - changed date format for proper lexicographical ordering
isatest
parents: 13359
diff changeset
    99
	echo "Have a nice day," >> $TMP
470daa444967 - changed date format for proper lexicographical ordering
isatest
parents: 13359
diff changeset
   100
	echo "  isatest" >> $TMP
13320
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
   101
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
   102
        for R in $MAILTO; do
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
   103
	    $MAIL "isabelle test failed" $R $TMP
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
   104
	done
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
   105
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
   106
	rm $TMP
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
   107
13236
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   108
	exit 1
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   109
else
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   110
        echo "$(date) $HOSTNAME $PRG: all tests successful, elapsed time $ELAPSED." >> $MASTERLOG
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   111
fi
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   112
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   113
# end