Admin/isatest-makeall
author kleing
Fri May 09 12:02:57 2003 +0200 (2003-05-09)
changeset 13990 506102b6a6d4
parent 13987 31891dd8c04b
child 13994 aa78df2e254b
permissions -rwxr-xr-x
tuned
     1 #!/usr/bin/env bash
     2 #
     3 # $Id$
     4 # Author: Gerwin Klein, TU Muenchen
     5 # License: GPL (GNU GENERAL PUBLIC LICENSE)
     6 #
     7 # DESCRIPTION: Run isatool makeall from specified distribution and settings.
     8 
     9 ## global settings
    10 
    11 # canoncical home for all platforms 
    12 HOME=/usr/stud/isatest
    13 
    14 # where the log files are
    15 LOGPREFIX=$HOME/log
    16 MASTERLOG=$LOGPREFIX/isatest.log
    17 ERRORLOG=$HOME/var/error.log
    18 
    19 # where to put test-is-running files
    20 RUNNING=$HOME/var/running
    21 
    22 
    23 ## diagnostics
    24 
    25 PRG="$(basename "$0")"
    26 
    27 function usage()
    28 {
    29   echo
    30   echo "Usage: $PRG distributionpath settings1 [settings2 ...]"
    31   echo
    32   echo "  Runs isatool makeall from specified distribution and settings."
    33   echo "  Leaves messages in ${ERRORLOG} and ${LOGPREFIX} if it fails."
    34   echo
    35   exit 1
    36 }
    37 
    38 function fail()
    39 {
    40   echo "$1" >&2
    41   exit 2
    42 }
    43 
    44 ## main
    45 
    46 # argument checking
    47 
    48 [ "$1" = "-?" ] && usage
    49 [ "$#" -lt "2" ] && usage
    50 
    51 DISTPREFIX=$1
    52 shift
    53 
    54 [ -d $DISTPREFIX ] || fail "$DISTPREFIX is not a directory."
    55 
    56 # make file flags and nice setup for different target platforms
    57 case $HOSTNAME in
    58     atbroy51)
    59         # 2 processors
    60         MFLAGS="-j 2"
    61         # MFLAGS=""
    62         NICE=""
    63         ;;
    64 
    65     atbroy31)
    66         # cluster
    67         MFLAGS="-j 5"
    68         ;;
    69   
    70     sunbroy2)
    71         MFLAGS="-j 6"
    72         ;;
    73 
    74     sunbroy1)
    75         MFLAGS="-j 2"
    76         ;;
    77 
    78     macbroy*)
    79         MFLAGS=""
    80         NICE=""
    81         ;;
    82 
    83     *)
    84         MFLAGS=""
    85         # be nice by default
    86         NICE=nice
    87         ;;
    88 esac
    89 
    90 # main test loop
    91 
    92 for SETTINGS in $@; do
    93 
    94     [ -r $SETTINGS ] || fail "Cannot read $SETTINGS."
    95 
    96     # logfile setup
    97 
    98     DATE=$(date "+%Y-%m-%d")
    99     SHORT=${SETTINGS##*/}
   100     TESTLOG=$LOGPREFIX/isatest-makeall-$SHORT-$DATE-$HOSTNAME.log
   101 
   102     # the test
   103 
   104     touch $RUNNING/$SHORT.running
   105 
   106     echo ------------------- starting test --- `date` --- $HOSTNAME > $TESTLOG 2>&1
   107 
   108     cat $SETTINGS >> $DISTPREFIX/Isabelle/etc/settings
   109     $NICE $DISTPREFIX/Isabelle/bin/isatool makeall $MFLAGS all >> $TESTLOG 2>&1 
   110 
   111     if [ $? -eq 0 ]
   112     then
   113         # test log and cleanup
   114         echo ------------------- test successful --- `date` --- $HOSTNAME >> $TESTLOG 2>&1
   115         gzip -f $TESTLOG
   116         rm -rf $HOME/isabelle-$SHORT
   117     else
   118         # test log
   119         echo ------------------- test FAILED --- `date` --- $HOSTNAME >> $TESTLOG 2>&1
   120 
   121         # error log
   122         echo "Test for platform ${SHORT}failed. Log file available at" >> $ERRORLOG
   123         echo "$HOSTNAME:$TESTLOG" >> $ERRORLOG
   124         echo "[...]" >> $ERRORLOG
   125         tail -3 $L >> $ERRORLOG
   126         echo >> $ERRORLOG
   127 
   128         FAIL="$FAIL$SHORT "
   129     fi
   130 
   131     rm -f $RUNNING/$SHORT.running
   132 done
   133 
   134 # time and success/failure to master log
   135 ELAPSED=$("$HOME/bin/showtime" "$SECONDS")
   136 
   137 if [ -z "$FAIL" ]; then
   138     echo "$(date) $HOSTNAME $PRG: all tests successful, elapsed time $ELAPSED." >> $MASTERLOG
   139 else
   140     echo "$(date) $HOSTNAME $PRG: targets ${FAIL}FAILED, elapsed time $ELAPSED." >> $MASTERLOG
   141     exit 1
   142 fi
   143 
   144 # end