Admin/isatest-makeall
author kleing
Fri, 22 Apr 2005 01:38:13 +0200
changeset 15808 cbe7ec0cdeb9
parent 14981 e73f8140af78
child 15888 64533471eec4
permissions -rwxr-xr-x
updated, added Admin/page after-release maintenance
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
#
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
     6
# DESCRIPTION: Run isatool makeall from specified distribution and settings.
13962
908f6776a59b use /usr/stud/isatest as home for all platforms (macbroy33 has no /home/stud/..)
kleing
parents: 13924
diff changeset
     7
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
     8
## global settings
13246
e51efc2029e9 email sending
isatest
parents: 13236
diff changeset
     9
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    10
# canoncical home for all platforms 
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    11
HOME=/usr/stud/isatest
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    12
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    13
# where the log files are
13962
908f6776a59b use /usr/stud/isatest as home for all platforms (macbroy33 has no /home/stud/..)
kleing
parents: 13924
diff changeset
    14
LOGPREFIX=$HOME/log
13236
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
    15
MASTERLOG=$LOGPREFIX/isatest.log
14035
c46ce87960fb attach log files
kleing
parents: 14012
diff changeset
    16
ERRORDIR=$HOME/var
c46ce87960fb attach log files
kleing
parents: 14012
diff changeset
    17
ERRORLOG=$ERRORDIR/error.log
13236
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
    18
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    19
# where to put test-is-running files
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    20
RUNNING=$HOME/var/running
13320
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
    21
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
    22
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    23
## diagnostics
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    24
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    25
PRG="$(basename "$0")"
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    26
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    27
function usage()
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    28
{
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    29
  echo
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    30
  echo "Usage: $PRG distributionpath settings1 [settings2 ...]"
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    31
  echo
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    32
  echo "  Runs isatool makeall from specified distribution and settings."
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    33
  echo "  Leaves messages in ${ERRORLOG} and ${LOGPREFIX} if it fails."
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    34
  echo
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    35
  exit 1
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    36
}
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    37
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    38
function fail()
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    39
{
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    40
  echo "$1" >&2
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    41
  exit 2
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    42
}
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    43
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    44
## main
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    45
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    46
# argument checking
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    47
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    48
[ "$1" = "-?" ] && usage
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    49
[ "$#" -lt "2" ] && usage
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    50
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    51
DISTPREFIX=$1
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    52
shift
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    53
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    54
[ -d $DISTPREFIX ] || fail "$DISTPREFIX is not a directory."
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    55
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    56
# make file flags and nice setup for different target platforms
13838
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    57
case $HOSTNAME in
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    58
    atbroy51)
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    59
        # 2 processors
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    60
        MFLAGS="-j 2"
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    61
        # MFLAGS=""
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    62
        NICE=""
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    63
        ;;
13838
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    64
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    65
    atbroy31)
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    66
        # cluster
13838
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
        ;;
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    69
  
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    70
    sunbroy2)
13990
kleing
parents: 13987
diff changeset
    71
        MFLAGS="-j 6"
14012
9d1f027eb4e8 be nice on sunbroy2
kleing
parents: 13994
diff changeset
    72
	NICE="nice"
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    73
        ;;
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    74
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    75
    sunbroy1)
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    76
        MFLAGS="-j 2"
14012
9d1f027eb4e8 be nice on sunbroy2
kleing
parents: 13994
diff changeset
    77
	NICE="nice"
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    78
        ;;
13838
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    79
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    80
    macbroy*)
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    81
        MFLAGS=""
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    82
        NICE=""
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    83
        ;;
13838
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    84
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    85
    *)
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    86
        MFLAGS=""
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    87
        # be nice by default
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    88
        NICE=nice
13838
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    89
        ;;
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    90
esac
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    91
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    92
# main test loop
13320
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
    93
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    94
for SETTINGS in $@; do
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    95
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    96
    [ -r $SETTINGS ] || fail "Cannot read $SETTINGS."
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    97
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    98
    # logfile setup
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    99
13432
470daa444967 - changed date format for proper lexicographical ordering
isatest
parents: 13359
diff changeset
   100
    DATE=$(date "+%Y-%m-%d")
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   101
    SHORT=${SETTINGS##*/}
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   102
    TESTLOG=$LOGPREFIX/isatest-makeall-$SHORT-$DATE-$HOSTNAME.log
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   103
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   104
    # the test
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   105
13987
kleing
parents: 13985
diff changeset
   106
    touch $RUNNING/$SHORT.running
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   107
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   108
    echo ------------------- starting test --- `date` --- $HOSTNAME > $TESTLOG 2>&1
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   109
13233
kleing
parents: 13232
diff changeset
   110
    cat $SETTINGS >> $DISTPREFIX/Isabelle/etc/settings
13924
09f6f2fefb25 no need to be nice everywhere
kleing
parents: 13901
diff changeset
   111
    $NICE $DISTPREFIX/Isabelle/bin/isatool makeall $MFLAGS all >> $TESTLOG 2>&1 
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   112
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   113
    if [ $? -eq 0 ]
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   114
    then
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   115
        # test log and cleanup
13236
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   116
        echo ------------------- test successful --- `date` --- $HOSTNAME >> $TESTLOG 2>&1
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   117
        gzip -f $TESTLOG
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   118
    else
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   119
        # test log
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   120
        echo ------------------- test FAILED --- `date` --- $HOSTNAME >> $TESTLOG 2>&1
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   121
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   122
        # error log
14035
c46ce87960fb attach log files
kleing
parents: 14012
diff changeset
   123
        echo "Test for platform ${SHORT} failed. Log file attached." >> $ERRORLOG
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   124
        echo "[...]" >> $ERRORLOG
14035
c46ce87960fb attach log files
kleing
parents: 14012
diff changeset
   125
        tail -3 $TESTLOG >> $ERRORLOG
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   126
        echo >> $ERRORLOG
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   127
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   128
        FAIL="$FAIL$SHORT "
14035
c46ce87960fb attach log files
kleing
parents: 14012
diff changeset
   129
        (cd $ERRORDIR; ln -s $TESTLOG)
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   130
    fi
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   131
13987
kleing
parents: 13985
diff changeset
   132
    rm -f $RUNNING/$SHORT.running
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   133
done
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   134
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   135
# time and success/failure to master log
13236
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   136
ELAPSED=$("$HOME/bin/showtime" "$SECONDS")
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   137
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   138
if [ -z "$FAIL" ]; then
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   139
    echo "$(date) $HOSTNAME $PRG: all tests successful, elapsed time $ELAPSED." >> $MASTERLOG
13236
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   140
else
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   141
    echo "$(date) $HOSTNAME $PRG: targets ${FAIL}FAILED, elapsed time $ELAPSED." >> $MASTERLOG
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   142
    exit 1
13236
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   143
fi
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   144
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   145
# end