Admin/isatest-makeall
author wenzelm
Fri, 13 Jan 2006 01:13:17 +0100
changeset 18673 fad60fe1565c
parent 17483 c6005bfc1630
permissions -rwxr-xr-x
mixfix: added Structure;
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
16095
f6af6b265d20 put global isatest settings in one file, sourced by the other scripts
kleing
parents: 15888
diff changeset
     9
. ~/admin/isatest-settings
13320
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
    10
15888
64533471eec4 put 8h time limit on test
kleing
parents: 14981
diff changeset
    11
# max time until test is aborted (in sec)
64533471eec4 put 8h time limit on test
kleing
parents: 14981
diff changeset
    12
MAXTIME=28800
13320
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
    13
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    14
## diagnostics
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    15
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    16
PRG="$(basename "$0")"
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    17
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    18
function usage()
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    19
{
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    20
  echo
17483
c6005bfc1630 update usage message
kleing
parents: 16617
diff changeset
    21
  echo "Usage: $PRG settings1 [settings2 ...]"
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    22
  echo
17483
c6005bfc1630 update usage message
kleing
parents: 16617
diff changeset
    23
  echo "  Runs isatool makeall for specified settings."
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    24
  echo "  Leaves messages in ${ERRORLOG} and ${LOGPREFIX} if it fails."
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    25
  echo
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    26
  exit 1
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    27
}
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    28
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    29
function fail()
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    30
{
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    31
  echo "$1" >&2
16097
8d41765e2884 log more failure types
kleing
parents: 16095
diff changeset
    32
  echo "$(date) $HOSTNAME $PRG: FAILED, $1" >> $MASTERLOG
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    33
  exit 2
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
## main
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    37
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    38
# argument checking
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    39
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    40
[ "$1" = "-?" ] && usage
16095
f6af6b265d20 put global isatest settings in one file, sourced by the other scripts
kleing
parents: 15888
diff changeset
    41
[ "$#" -lt "1" ] && usage
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    42
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    43
[ -d $DISTPREFIX ] || fail "$DISTPREFIX is not a directory."
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    44
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    45
# make file flags and nice setup for different target platforms
13838
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    46
case $HOSTNAME in
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    47
    atbroy51)
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    48
        # 2 processors
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    49
        MFLAGS="-j 2"
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    50
        # MFLAGS=""
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    51
        NICE=""
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    52
        ;;
13838
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    53
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    54
    atbroy31)
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    55
        # cluster
13838
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    56
        MFLAGS="-j 5"
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    57
        ;;
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    58
  
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    59
    sunbroy2)
13990
kleing
parents: 13987
diff changeset
    60
        MFLAGS="-j 6"
16097
8d41765e2884 log more failure types
kleing
parents: 16095
diff changeset
    61
        NICE="nice"
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    62
        ;;
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    63
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    64
    sunbroy1)
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    65
        MFLAGS="-j 2"
16097
8d41765e2884 log more failure types
kleing
parents: 16095
diff changeset
    66
        NICE="nice"
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    67
        ;;
13838
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    68
16567
1ff73dc29166 use both processors on macbroy5
kleing
parents: 16097
diff changeset
    69
    macbroy5)
16617
edec7bf2186a use only 1 CPU on MacOS 10.4.1
kleing
parents: 16567
diff changeset
    70
        MFLAGS="" # -j 2 does not work on poly/macos 10.4.1
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    71
        NICE=""
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    72
        ;;
13838
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    73
13985
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
        MFLAGS=""
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    76
        # be nice by default
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    77
        NICE=nice
13838
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    78
        ;;
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    79
esac
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    80
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    81
# main test loop
13320
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
    82
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    83
for SETTINGS in $@; do
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    84
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    85
    [ -r $SETTINGS ] || fail "Cannot read $SETTINGS."
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    86
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    87
    # logfile setup
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    88
13432
470daa444967 - changed date format for proper lexicographical ordering
isatest
parents: 13359
diff changeset
    89
    DATE=$(date "+%Y-%m-%d")
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    90
    SHORT=${SETTINGS##*/}
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    91
    TESTLOG=$LOGPREFIX/isatest-makeall-$SHORT-$DATE-$HOSTNAME.log
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    92
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    93
    # the test
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    94
13987
kleing
parents: 13985
diff changeset
    95
    touch $RUNNING/$SHORT.running
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    96
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    97
    echo ------------------- starting test --- `date` --- $HOSTNAME > $TESTLOG 2>&1
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    98
13233
kleing
parents: 13232
diff changeset
    99
    cat $SETTINGS >> $DISTPREFIX/Isabelle/etc/settings
15888
64533471eec4 put 8h time limit on test
kleing
parents: 14981
diff changeset
   100
    (ulimit -t $MAXTIME; $NICE $DISTPREFIX/Isabelle/bin/isatool makeall $MFLAGS all >> $TESTLOG 2>&1)
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   101
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   102
    if [ $? -eq 0 ]
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   103
    then
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   104
        # test log and cleanup
13236
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   105
        echo ------------------- test successful --- `date` --- $HOSTNAME >> $TESTLOG 2>&1
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   106
        gzip -f $TESTLOG
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   107
    else
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   108
        # test log
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   109
        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
   110
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   111
        # error log
14035
c46ce87960fb attach log files
kleing
parents: 14012
diff changeset
   112
        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
   113
        echo "[...]" >> $ERRORLOG
14035
c46ce87960fb attach log files
kleing
parents: 14012
diff changeset
   114
        tail -3 $TESTLOG >> $ERRORLOG
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   115
        echo >> $ERRORLOG
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   116
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   117
        FAIL="$FAIL$SHORT "
14035
c46ce87960fb attach log files
kleing
parents: 14012
diff changeset
   118
        (cd $ERRORDIR; ln -s $TESTLOG)
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   119
    fi
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   120
13987
kleing
parents: 13985
diff changeset
   121
    rm -f $RUNNING/$SHORT.running
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   122
done
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   123
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   124
# time and success/failure to master log
13236
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   125
ELAPSED=$("$HOME/bin/showtime" "$SECONDS")
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   126
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   127
if [ -z "$FAIL" ]; then
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   128
    echo "$(date) $HOSTNAME $PRG: all tests successful, elapsed time $ELAPSED." >> $MASTERLOG
13236
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   129
else
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   130
    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
   131
    exit 1
13236
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   132
fi
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   133
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   134
# end