Admin/isatest-makeall
author wenzelm
Tue Jul 05 16:49:15 2005 +0200 (2005-07-05)
changeset 16693 75f39d66425d
parent 16617 edec7bf2186a
child 17483 c6005bfc1630
permissions -rwxr-xr-x
fixed regexp grouping;
kleing@13231
     1
#!/usr/bin/env bash
kleing@13231
     2
#
kleing@13231
     3
# $Id$
kleing@13231
     4
# Author: Gerwin Klein, TU Muenchen
kleing@13231
     5
#
kleing@13231
     6
# DESCRIPTION: Run isatool makeall from specified distribution and settings.
kleing@13962
     7
kleing@13231
     8
## global settings
kleing@16095
     9
. ~/admin/isatest-settings
isatest@13320
    10
kleing@15888
    11
# max time until test is aborted (in sec)
kleing@15888
    12
MAXTIME=28800
isatest@13320
    13
kleing@13231
    14
## diagnostics
kleing@13231
    15
kleing@13231
    16
PRG="$(basename "$0")"
kleing@13231
    17
kleing@13231
    18
function usage()
kleing@13231
    19
{
kleing@13231
    20
  echo
kleing@13231
    21
  echo "Usage: $PRG distributionpath settings1 [settings2 ...]"
kleing@13231
    22
  echo
kleing@13985
    23
  echo "  Runs isatool makeall from specified distribution and settings."
kleing@13985
    24
  echo "  Leaves messages in ${ERRORLOG} and ${LOGPREFIX} if it fails."
kleing@13231
    25
  echo
kleing@13231
    26
  exit 1
kleing@13231
    27
}
kleing@13231
    28
kleing@13231
    29
function fail()
kleing@13231
    30
{
kleing@13231
    31
  echo "$1" >&2
kleing@16097
    32
  echo "$(date) $HOSTNAME $PRG: FAILED, $1" >> $MASTERLOG
kleing@13231
    33
  exit 2
kleing@13231
    34
}
kleing@13231
    35
kleing@13231
    36
## main
kleing@13231
    37
kleing@13231
    38
# argument checking
kleing@13231
    39
kleing@13231
    40
[ "$1" = "-?" ] && usage
kleing@16095
    41
[ "$#" -lt "1" ] && usage
kleing@13231
    42
kleing@13231
    43
[ -d $DISTPREFIX ] || fail "$DISTPREFIX is not a directory."
kleing@13231
    44
kleing@13985
    45
# make file flags and nice setup for different target platforms
isatest@13838
    46
case $HOSTNAME in
kleing@13985
    47
    atbroy51)
kleing@13985
    48
        # 2 processors
kleing@13985
    49
        MFLAGS="-j 2"
kleing@13985
    50
        # MFLAGS=""
kleing@13985
    51
        NICE=""
kleing@13985
    52
        ;;
isatest@13838
    53
kleing@13985
    54
    atbroy31)
kleing@13985
    55
        # cluster
isatest@13838
    56
        MFLAGS="-j 5"
isatest@13838
    57
        ;;
kleing@13985
    58
  
kleing@13985
    59
    sunbroy2)
kleing@13990
    60
        MFLAGS="-j 6"
kleing@16097
    61
        NICE="nice"
kleing@13985
    62
        ;;
kleing@13985
    63
kleing@13985
    64
    sunbroy1)
kleing@13985
    65
        MFLAGS="-j 2"
kleing@16097
    66
        NICE="nice"
kleing@13985
    67
        ;;
isatest@13838
    68
kleing@16567
    69
    macbroy5)
kleing@16617
    70
        MFLAGS="" # -j 2 does not work on poly/macos 10.4.1
kleing@13985
    71
        NICE=""
kleing@13985
    72
        ;;
isatest@13838
    73
kleing@13985
    74
    *)
kleing@13985
    75
        MFLAGS=""
kleing@13985
    76
        # be nice by default
kleing@13985
    77
        NICE=nice
isatest@13838
    78
        ;;
isatest@13838
    79
esac
isatest@13838
    80
kleing@13985
    81
# main test loop
isatest@13320
    82
kleing@13231
    83
for SETTINGS in $@; do
kleing@13231
    84
kleing@13231
    85
    [ -r $SETTINGS ] || fail "Cannot read $SETTINGS."
kleing@13231
    86
kleing@13231
    87
    # logfile setup
kleing@13231
    88
isatest@13432
    89
    DATE=$(date "+%Y-%m-%d")
kleing@13231
    90
    SHORT=${SETTINGS##*/}
kleing@13231
    91
    TESTLOG=$LOGPREFIX/isatest-makeall-$SHORT-$DATE-$HOSTNAME.log
kleing@13231
    92
kleing@13231
    93
    # the test
kleing@13231
    94
kleing@13987
    95
    touch $RUNNING/$SHORT.running
kleing@13985
    96
kleing@13231
    97
    echo ------------------- starting test --- `date` --- $HOSTNAME > $TESTLOG 2>&1
kleing@13231
    98
kleing@13233
    99
    cat $SETTINGS >> $DISTPREFIX/Isabelle/etc/settings
kleing@15888
   100
    (ulimit -t $MAXTIME; $NICE $DISTPREFIX/Isabelle/bin/isatool makeall $MFLAGS all >> $TESTLOG 2>&1)
kleing@13231
   101
kleing@13231
   102
    if [ $? -eq 0 ]
kleing@13231
   103
    then
kleing@13985
   104
        # test log and cleanup
isatest@13236
   105
        echo ------------------- test successful --- `date` --- $HOSTNAME >> $TESTLOG 2>&1
kleing@13231
   106
        gzip -f $TESTLOG
kleing@13231
   107
    else
kleing@13985
   108
        # test log
kleing@13231
   109
        echo ------------------- test FAILED --- `date` --- $HOSTNAME >> $TESTLOG 2>&1
kleing@13985
   110
kleing@13985
   111
        # error log
kleing@14035
   112
        echo "Test for platform ${SHORT} failed. Log file attached." >> $ERRORLOG
kleing@13985
   113
        echo "[...]" >> $ERRORLOG
kleing@14035
   114
        tail -3 $TESTLOG >> $ERRORLOG
kleing@13985
   115
        echo >> $ERRORLOG
kleing@13985
   116
kleing@13985
   117
        FAIL="$FAIL$SHORT "
kleing@14035
   118
        (cd $ERRORDIR; ln -s $TESTLOG)
kleing@13231
   119
    fi
kleing@13231
   120
kleing@13987
   121
    rm -f $RUNNING/$SHORT.running
kleing@13231
   122
done
kleing@13231
   123
kleing@13985
   124
# time and success/failure to master log
isatest@13236
   125
ELAPSED=$("$HOME/bin/showtime" "$SECONDS")
isatest@13236
   126
kleing@13985
   127
if [ -z "$FAIL" ]; then
kleing@13985
   128
    echo "$(date) $HOSTNAME $PRG: all tests successful, elapsed time $ELAPSED." >> $MASTERLOG
isatest@13236
   129
else
kleing@13985
   130
    echo "$(date) $HOSTNAME $PRG: targets ${FAIL}FAILED, elapsed time $ELAPSED." >> $MASTERLOG
kleing@13985
   131
    exit 1
isatest@13236
   132
fi
isatest@13236
   133
isatest@13236
   134
# end