Admin/isatest-makeall
author kleing
Fri, 09 May 2003 12:02:57 +0200
changeset 13990 506102b6a6d4
parent 13987 31891dd8c04b
child 13994 aa78df2e254b
permissions -rwxr-xr-x
tuned
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.
13962
908f6776a59b use /usr/stud/isatest as home for all platforms (macbroy33 has no /home/stud/..)
kleing
parents: 13924
diff changeset
     8
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
     9
## global settings
13246
e51efc2029e9 email sending
isatest
parents: 13236
diff changeset
    10
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    11
# canoncical home for all platforms 
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    12
HOME=/usr/stud/isatest
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    13
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    14
# 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
    15
LOGPREFIX=$HOME/log
13236
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
    16
MASTERLOG=$LOGPREFIX/isatest.log
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    17
ERRORLOG=$HOME/var/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"
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    72
        ;;
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
    sunbroy1)
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    75
        MFLAGS="-j 2"
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    76
        ;;
13838
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    77
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    78
    macbroy*)
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    79
        MFLAGS=""
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    80
        NICE=""
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    81
        ;;
13838
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    82
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    83
    *)
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    84
        MFLAGS=""
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    85
        # be nice by default
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    86
        NICE=nice
13838
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
esac
fe83f2231767 case distinction on host for makefile flags
isatest
parents: 13432
diff changeset
    89
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
    90
# main test loop
13320
2c6ee189ae63 send email plaform independently
isatest
parents: 13246
diff changeset
    91
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    92
for SETTINGS in $@; do
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    93
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
    94
    [ -r $SETTINGS ] || fail "Cannot read $SETTINGS."
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
13987
kleing
parents: 13985
diff changeset
   104
    touch $RUNNING/$SHORT.running
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   105
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   106
    echo ------------------- starting test --- `date` --- $HOSTNAME > $TESTLOG 2>&1
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   107
13233
kleing
parents: 13232
diff changeset
   108
    cat $SETTINGS >> $DISTPREFIX/Isabelle/etc/settings
13924
09f6f2fefb25 no need to be nice everywhere
kleing
parents: 13901
diff changeset
   109
    $NICE $DISTPREFIX/Isabelle/bin/isatool makeall $MFLAGS all >> $TESTLOG 2>&1 
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   110
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   111
    if [ $? -eq 0 ]
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   112
    then
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   113
        # test log and cleanup
13236
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   114
        echo ------------------- test successful --- `date` --- $HOSTNAME >> $TESTLOG 2>&1
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   115
        gzip -f $TESTLOG
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   116
        rm -rf $HOME/isabelle-$SHORT
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   117
    else
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   118
        # test log
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   119
        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
   120
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   121
        # error log
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   122
        echo "Test for platform ${SHORT}failed. Log file available at" >> $ERRORLOG
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   123
        echo "$HOSTNAME:$TESTLOG" >> $ERRORLOG
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   124
        echo "[...]" >> $ERRORLOG
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   125
        tail -3 $L >> $ERRORLOG
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 "
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   129
    fi
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   130
13987
kleing
parents: 13985
diff changeset
   131
    rm -f $RUNNING/$SHORT.running
13231
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   132
done
cce28efb2600 for nightly test builds
kleing
parents:
diff changeset
   133
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   134
# time and success/failure to master log
13236
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   135
ELAPSED=$("$HOME/bin/showtime" "$SECONDS")
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   136
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   137
if [ -z "$FAIL" ]; then
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   138
    echo "$(date) $HOSTNAME $PRG: all tests successful, elapsed time $ELAPSED." >> $MASTERLOG
13236
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   139
else
13985
3852929a8d1d leave error messages in error.log, send only one email for all platforms
kleing
parents: 13962
diff changeset
   140
    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
   141
    exit 1
13236
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   142
fi
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   143
568bc754d303 included masterlog file
isatest
parents: 13233
diff changeset
   144
# end