Admin/isatest-makeall
author kleing
Tue, 06 May 2003 09:23:13 +0200
changeset 13962 908f6776a59b
parent 13924 09f6f2fefb25
child 13985 3852929a8d1d
permissions -rwxr-xr-x
use /usr/stud/isatest as home for all platforms (macbroy33 has no /home/stud/..)
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
13962
908f6776a59b use /usr/stud/isatest as home for all platforms (macbroy33 has no /home/stud/..)
kleing
parents: 13924
diff changeset
    10
# canoncical home for all platforms
908f6776a59b use /usr/stud/isatest as home for all platforms (macbroy33 has no /home/stud/..)
kleing
parents: 13924
diff changeset
    11
HOME=/usr/stud/isatest
908f6776a59b use /usr/stud/isatest as home for all platforms (macbroy33 has no /home/stud/..)
kleing
parents: 13924
diff changeset
    12
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    13
## global settings
13838
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    14
MAILTO="kleing@in.tum.de nipkow@in.tum.de berghofe@in.tum.de schirmer@in.tum.de lp15@cam.ac.uk"
13246
e51efc2029e9 email sending
isatest
parents: 13236
diff changeset
    15
13962
908f6776a59b use /usr/stud/isatest as home for all platforms (macbroy33 has no /home/stud/..)
kleing
parents: 13924
diff changeset
    16
LOGPREFIX=$HOME/log
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    17
13236
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
    18
MASTERLOG=$LOGPREFIX/isatest.log
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
    19
13320
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
    20
TMP=/tmp/isatest-makeall.$$
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
    21
13962
908f6776a59b use /usr/stud/isatest as home for all platforms (macbroy33 has no /home/stud/..)
kleing
parents: 13924
diff changeset
    22
MAIL=$HOME/bin/pmail
13320
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
    23
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    24
## diagnostics
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    25
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    26
PRG="$(basename "$0")"
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    27
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    28
function usage()
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    29
{
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    30
  echo
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    31
  echo "Usage: $PRG distributionpath settings1 [settings2 ...]"
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    32
  echo
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    33
  echo "  Run isatool makeall from specified distribution and settings."
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    34
  echo "  Send email if it fails."
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    35
  echo
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    36
  exit 1
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    37
}
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    38
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    39
function fail()
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    40
{
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    41
  echo "$1" >&2
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    42
  exit 2
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    43
}
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    44
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    45
## main
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    46
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    47
# argument checking
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    48
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    49
[ "$1" = "-?" ] && usage
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    50
[ "$#" -lt "2" ] && usage
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    51
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    52
DISTPREFIX=$1
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    53
shift
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    54
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    55
[ -d $DISTPREFIX ] || fail "$DISTPREFIX is not a directory."
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    56
13924
09f6f2fefb25 no need to be nice everywhere
kleing
parents: 13901
diff changeset
    57
NICE=nice
09f6f2fefb25 no need to be nice everywhere
kleing
parents: 13901
diff changeset
    58
13838
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    59
case $HOSTNAME in
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    60
        atbroy51)
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    61
	MFLAGS="-j 2"
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    62
	# MFLAGS=""
13924
09f6f2fefb25 no need to be nice everywhere
kleing
parents: 13901
diff changeset
    63
  NICE=""
13838
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    64
	;;
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    65
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    66
        atbroy31)
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    67
        MFLAGS="-j 5"
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    68
        ;;
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    69
	
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    70
	atbroy12)
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    71
	MFLAGS="-j 5"
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    72
	;;
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    73
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    74
	sunbroy2)
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    75
	MFLAGS="-j 4"
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    76
	;;
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    77
13901
af38553e61ee use 2 processors on sunbroy1
kleing
parents: 13838
diff changeset
    78
	sunbroy1)
af38553e61ee use 2 processors on sunbroy1
kleing
parents: 13838
diff changeset
    79
	MFLAGS="-j 2"
af38553e61ee use 2 processors on sunbroy1
kleing
parents: 13838
diff changeset
    80
	;;
af38553e61ee use 2 processors on sunbroy1
kleing
parents: 13838
diff changeset
    81
13838
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    82
   	*)
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    83
	MFLAGS=""
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    84
        ;;
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    85
esac
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    86
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    87
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    88
13320
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
    89
LOGS=""
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
    90
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    91
for SETTINGS in $@; do
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    92
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    93
    [ -r $SETTINGS ] || fail "Cannot read $SETTINGS."
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    94
    
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    95
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    96
    # logfile setup
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    97
13432
470daa444967 - changed date format for proper lexicographical ordering
isatest
parents: 13359
diff changeset
    98
    DATE=$(date "+%Y-%m-%d")
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    99
    SHORT=${SETTINGS##*/}
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   100
    TESTLOG=$LOGPREFIX/isatest-makeall-$SHORT-$DATE-$HOSTNAME.log
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   101
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   102
    # the test
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   103
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   104
    echo ------------------- starting test --- `date` --- $HOSTNAME > $TESTLOG 2>&1
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   105
13233
kleing
parents: 13232
diff changeset
   106
    cat $SETTINGS >> $DISTPREFIX/Isabelle/etc/settings
13924
09f6f2fefb25 no need to be nice everywhere
kleing
parents: 13901
diff changeset
   107
    $NICE $DISTPREFIX/Isabelle/bin/isatool makeall $MFLAGS all >> $TESTLOG 2>&1 
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   108
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   109
    if [ $? -eq 0 ]
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   110
    then
13236
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   111
        echo ------------------- test successful --- `date` --- $HOSTNAME >> $TESTLOG 2>&1
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   112
        gzip -f $TESTLOG
13962
908f6776a59b use /usr/stud/isatest as home for all platforms (macbroy33 has no /home/stud/..)
kleing
parents: 13924
diff changeset
   113
	rm -rf $HOME/isabelle-$SHORT
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   114
    else
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   115
        echo ------------------- test FAILED --- `date` --- $HOSTNAME >> $TESTLOG 2>&1
13236
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   116
	FAIL="$FAIL$SHORT "
13432
470daa444967 - changed date format for proper lexicographical ordering
isatest
parents: 13359
diff changeset
   117
	LOGS="${LOGS}$TESTLOG "
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   118
    fi
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   119
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   120
done
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   121
13236
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   122
ELAPSED=$("$HOME/bin/showtime" "$SECONDS")
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   123
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   124
if [ "$FAIL" != "" ]; then
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   125
	echo "$(date) $HOSTNAME $PRG: targets ${FAIL}FAILED, elapsed time $ELAPSED." >> $MASTERLOG
13320
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
   126
	
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
   127
	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
   128
	for L in $LOGS; do 
470daa444967 - changed date format for proper lexicographical ordering
isatest
parents: 13359
diff changeset
   129
		echo "$HOSTNAME:$L" >> $TMP 
470daa444967 - changed date format for proper lexicographical ordering
isatest
parents: 13359
diff changeset
   130
		echo "[...]" >> $TMP
470daa444967 - changed date format for proper lexicographical ordering
isatest
parents: 13359
diff changeset
   131
		tail -3 $L >> $TMP
470daa444967 - changed date format for proper lexicographical ordering
isatest
parents: 13359
diff changeset
   132
		echo >> $TMP
470daa444967 - changed date format for proper lexicographical ordering
isatest
parents: 13359
diff changeset
   133
	done
470daa444967 - changed date format for proper lexicographical ordering
isatest
parents: 13359
diff changeset
   134
	echo "Have a nice day," >> $TMP
470daa444967 - changed date format for proper lexicographical ordering
isatest
parents: 13359
diff changeset
   135
	echo "  isatest" >> $TMP
13320
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
   136
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
   137
        for R in $MAILTO; do
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
   138
	    $MAIL "isabelle test failed" $R $TMP
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
   139
	done
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
   140
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
   141
	rm $TMP
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
   142
13236
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   143
	exit 1
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   144
else
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   145
        echo "$(date) $HOSTNAME $PRG: all tests successful, elapsed time $ELAPSED." >> $MASTERLOG
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   146
fi
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   147
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   148
# end