| author | paulson | 
| Tue, 22 Mar 2005 16:31:51 +0100 | |
| changeset 15616 | cdf6eeb4ac27 | 
| parent 14981 | e73f8140af78 | 
| child 15888 | 64533471eec4 | 
| permissions | -rwxr-xr-x | 
| 13231 | 1 | #!/usr/bin/env bash | 
| 2 | # | |
| 3 | # $Id$ | |
| 4 | # Author: Gerwin Klein, TU Muenchen | |
| 5 | # | |
| 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: 
13924diff
changeset | 7 | |
| 13231 | 8 | ## global settings | 
| 13246 | 9 | |
| 13985 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 10 | # canoncical home for all platforms | 
| 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 11 | HOME=/usr/stud/isatest | 
| 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 12 | |
| 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
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: 
13924diff
changeset | 14 | LOGPREFIX=$HOME/log | 
| 13236 | 15 | MASTERLOG=$LOGPREFIX/isatest.log | 
| 14035 | 16 | ERRORDIR=$HOME/var | 
| 17 | ERRORLOG=$ERRORDIR/error.log | |
| 13236 | 18 | |
| 13985 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
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: 
13962diff
changeset | 20 | RUNNING=$HOME/var/running | 
| 13320 | 21 | |
| 22 | ||
| 13231 | 23 | ## diagnostics | 
| 24 | ||
| 25 | PRG="$(basename "$0")" | |
| 26 | ||
| 27 | function usage() | |
| 28 | {
 | |
| 29 | echo | |
| 30 | echo "Usage: $PRG distributionpath settings1 [settings2 ...]" | |
| 31 | echo | |
| 13985 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
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: 
13962diff
changeset | 33 |   echo "  Leaves messages in ${ERRORLOG} and ${LOGPREFIX} if it fails."
 | 
| 13231 | 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 | ||
| 13985 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 56 | # make file flags and nice setup for different target platforms | 
| 13838 | 57 | case $HOSTNAME in | 
| 13985 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 58 | atbroy51) | 
| 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 59 | # 2 processors | 
| 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 60 | MFLAGS="-j 2" | 
| 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 61 | # MFLAGS="" | 
| 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 62 | NICE="" | 
| 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 63 | ;; | 
| 13838 | 64 | |
| 13985 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 65 | atbroy31) | 
| 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 66 | # cluster | 
| 13838 | 67 | MFLAGS="-j 5" | 
| 68 | ;; | |
| 13985 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 69 | |
| 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 70 | sunbroy2) | 
| 13990 | 71 | MFLAGS="-j 6" | 
| 14012 | 72 | NICE="nice" | 
| 13985 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 73 | ;; | 
| 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 74 | |
| 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 75 | sunbroy1) | 
| 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 76 | MFLAGS="-j 2" | 
| 14012 | 77 | NICE="nice" | 
| 13985 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 78 | ;; | 
| 13838 | 79 | |
| 13985 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 80 | macbroy*) | 
| 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 81 | MFLAGS="" | 
| 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 82 | NICE="" | 
| 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 83 | ;; | 
| 13838 | 84 | |
| 13985 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 85 | *) | 
| 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 86 | MFLAGS="" | 
| 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 87 | # be nice by default | 
| 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 88 | NICE=nice | 
| 13838 | 89 | ;; | 
| 90 | esac | |
| 91 | ||
| 13985 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 92 | # main test loop | 
| 13320 | 93 | |
| 13231 | 94 | for SETTINGS in $@; do | 
| 95 | ||
| 96 | [ -r $SETTINGS ] || fail "Cannot read $SETTINGS." | |
| 97 | ||
| 98 | # logfile setup | |
| 99 | ||
| 13432 
470daa444967
- changed date format for proper lexicographical ordering
 isatest parents: 
13359diff
changeset | 100 | DATE=$(date "+%Y-%m-%d") | 
| 13231 | 101 |     SHORT=${SETTINGS##*/}
 | 
| 102 | TESTLOG=$LOGPREFIX/isatest-makeall-$SHORT-$DATE-$HOSTNAME.log | |
| 103 | ||
| 104 | # the test | |
| 105 | ||
| 13987 | 106 | touch $RUNNING/$SHORT.running | 
| 13985 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 107 | |
| 13231 | 108 | echo ------------------- starting test --- `date` --- $HOSTNAME > $TESTLOG 2>&1 | 
| 109 | ||
| 13233 | 110 | cat $SETTINGS >> $DISTPREFIX/Isabelle/etc/settings | 
| 13924 | 111 | $NICE $DISTPREFIX/Isabelle/bin/isatool makeall $MFLAGS all >> $TESTLOG 2>&1 | 
| 13231 | 112 | |
| 113 | if [ $? -eq 0 ] | |
| 114 | then | |
| 13985 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 115 | # test log and cleanup | 
| 13236 | 116 | echo ------------------- test successful --- `date` --- $HOSTNAME >> $TESTLOG 2>&1 | 
| 13231 | 117 | gzip -f $TESTLOG | 
| 118 | else | |
| 13985 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 119 | # test log | 
| 13231 | 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: 
13962diff
changeset | 121 | |
| 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 122 | # error log | 
| 14035 | 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: 
13962diff
changeset | 124 | echo "[...]" >> $ERRORLOG | 
| 14035 | 125 | tail -3 $TESTLOG >> $ERRORLOG | 
| 13985 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 126 | echo >> $ERRORLOG | 
| 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 127 | |
| 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 128 | FAIL="$FAIL$SHORT " | 
| 14035 | 129 | (cd $ERRORDIR; ln -s $TESTLOG) | 
| 13231 | 130 | fi | 
| 131 | ||
| 13987 | 132 | rm -f $RUNNING/$SHORT.running | 
| 13231 | 133 | done | 
| 134 | ||
| 13985 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 135 | # time and success/failure to master log | 
| 13236 | 136 | ELAPSED=$("$HOME/bin/showtime" "$SECONDS")
 | 
| 137 | ||
| 13985 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 138 | if [ -z "$FAIL" ]; then | 
| 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
changeset | 139 | echo "$(date) $HOSTNAME $PRG: all tests successful, elapsed time $ELAPSED." >> $MASTERLOG | 
| 13236 | 140 | else | 
| 13985 
3852929a8d1d
leave error messages in error.log, send only one email for all platforms
 kleing parents: 
13962diff
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: 
13962diff
changeset | 142 | exit 1 | 
| 13236 | 143 | fi | 
| 144 | ||
| 145 | # end |