author | kleing |
Tue, 06 May 2003 09:23:13 +0200 | |
changeset 13962 | 908f6776a59b |
parent 13924 | 09f6f2fefb25 |
child 13985 | 3852929a8d1d |
permissions | -rwxr-xr-x |
13231 | 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 |
# Send email if it fails. |
|
9 |
||
13962
908f6776a59b
use /usr/stud/isatest as home for all platforms (macbroy33 has no /home/stud/..)
kleing
parents:
13924
diff
changeset
|
10 |
# canoncical home for all platforms |
908f6776a59b
use /usr/stud/isatest as home for all platforms (macbroy33 has no /home/stud/..)
kleing
parents:
13924
diff
changeset
|
11 |
HOME=/usr/stud/isatest |
908f6776a59b
use /usr/stud/isatest as home for all platforms (macbroy33 has no /home/stud/..)
kleing
parents:
13924
diff
changeset
|
12 |
|
13231 | 13 |
## global settings |
13838 | 14 |
MAILTO="kleing@in.tum.de nipkow@in.tum.de berghofe@in.tum.de schirmer@in.tum.de lp15@cam.ac.uk" |
13246 | 15 |
|
13962
908f6776a59b
use /usr/stud/isatest as home for all platforms (macbroy33 has no /home/stud/..)
kleing
parents:
13924
diff
changeset
|
16 |
LOGPREFIX=$HOME/log |
13231 | 17 |
|
13236 | 18 |
MASTERLOG=$LOGPREFIX/isatest.log |
19 |
||
13320 | 20 |
TMP=/tmp/isatest-makeall.$$ |
21 |
||
13962
908f6776a59b
use /usr/stud/isatest as home for all platforms (macbroy33 has no /home/stud/..)
kleing
parents:
13924
diff
changeset
|
22 |
MAIL=$HOME/bin/pmail |
13320 | 23 |
|
13231 | 24 |
## diagnostics |
25 |
||
26 |
PRG="$(basename "$0")" |
|
27 |
||
28 |
function usage() |
|
29 |
{ |
|
30 |
echo |
|
31 |
echo "Usage: $PRG distributionpath settings1 [settings2 ...]" |
|
32 |
echo |
|
33 |
echo " Run isatool makeall from specified distribution and settings." |
|
34 |
echo " Send email if it fails." |
|
35 |
echo |
|
36 |
exit 1 |
|
37 |
} |
|
38 |
||
39 |
function fail() |
|
40 |
{ |
|
41 |
echo "$1" >&2 |
|
42 |
exit 2 |
|
43 |
} |
|
44 |
||
45 |
## main |
|
46 |
||
47 |
# argument checking |
|
48 |
||
49 |
[ "$1" = "-?" ] && usage |
|
50 |
[ "$#" -lt "2" ] && usage |
|
51 |
||
52 |
DISTPREFIX=$1 |
|
53 |
shift |
|
54 |
||
55 |
[ -d $DISTPREFIX ] || fail "$DISTPREFIX is not a directory." |
|
56 |
||
13924 | 57 |
NICE=nice |
58 |
||
13838 | 59 |
case $HOSTNAME in |
60 |
atbroy51) |
|
61 |
MFLAGS="-j 2" |
|
62 |
# MFLAGS="" |
|
13924 | 63 |
NICE="" |
13838 | 64 |
;; |
65 |
||
66 |
atbroy31) |
|
67 |
MFLAGS="-j 5" |
|
68 |
;; |
|
69 |
||
70 |
atbroy12) |
|
71 |
MFLAGS="-j 5" |
|
72 |
;; |
|
73 |
||
74 |
sunbroy2) |
|
75 |
MFLAGS="-j 4" |
|
76 |
;; |
|
77 |
||
13901 | 78 |
sunbroy1) |
79 |
MFLAGS="-j 2" |
|
80 |
;; |
|
81 |
||
13838 | 82 |
*) |
83 |
MFLAGS="" |
|
84 |
;; |
|
85 |
esac |
|
86 |
||
87 |
||
88 |
||
13320 | 89 |
LOGS="" |
90 |
||
13231 | 91 |
for SETTINGS in $@; do |
92 |
||
93 |
[ -r $SETTINGS ] || fail "Cannot read $SETTINGS." |
|
94 |
||
95 |
||
96 |
# logfile setup |
|
97 |
||
13432
470daa444967
- changed date format for proper lexicographical ordering
isatest
parents:
13359
diff
changeset
|
98 |
DATE=$(date "+%Y-%m-%d") |
13231 | 99 |
SHORT=${SETTINGS##*/} |
100 |
TESTLOG=$LOGPREFIX/isatest-makeall-$SHORT-$DATE-$HOSTNAME.log |
|
101 |
||
102 |
# the test |
|
103 |
||
104 |
echo ------------------- starting test --- `date` --- $HOSTNAME > $TESTLOG 2>&1 |
|
105 |
||
13233 | 106 |
cat $SETTINGS >> $DISTPREFIX/Isabelle/etc/settings |
13924 | 107 |
$NICE $DISTPREFIX/Isabelle/bin/isatool makeall $MFLAGS all >> $TESTLOG 2>&1 |
13231 | 108 |
|
109 |
if [ $? -eq 0 ] |
|
110 |
then |
|
13236 | 111 |
echo ------------------- test successful --- `date` --- $HOSTNAME >> $TESTLOG 2>&1 |
13231 | 112 |
gzip -f $TESTLOG |
13962
908f6776a59b
use /usr/stud/isatest as home for all platforms (macbroy33 has no /home/stud/..)
kleing
parents:
13924
diff
changeset
|
113 |
rm -rf $HOME/isabelle-$SHORT |
13231 | 114 |
else |
115 |
echo ------------------- test FAILED --- `date` --- $HOSTNAME >> $TESTLOG 2>&1 |
|
13236 | 116 |
FAIL="$FAIL$SHORT " |
13432
470daa444967
- changed date format for proper lexicographical ordering
isatest
parents:
13359
diff
changeset
|
117 |
LOGS="${LOGS}$TESTLOG " |
13231 | 118 |
fi |
119 |
||
120 |
done |
|
121 |
||
13236 | 122 |
ELAPSED=$("$HOME/bin/showtime" "$SECONDS") |
123 |
||
124 |
if [ "$FAIL" != "" ]; then |
|
125 |
echo "$(date) $HOSTNAME $PRG: targets ${FAIL}FAILED, elapsed time $ELAPSED." >> $MASTERLOG |
|
13320 | 126 |
|
127 |
echo "Test for platform(s) ${FAIL}failed. Log file(s) available at" > $TMP |
|
13432
470daa444967
- changed date format for proper lexicographical ordering
isatest
parents:
13359
diff
changeset
|
128 |
for L in $LOGS; do |
470daa444967
- changed date format for proper lexicographical ordering
isatest
parents:
13359
diff
changeset
|
129 |
echo "$HOSTNAME:$L" >> $TMP |
470daa444967
- changed date format for proper lexicographical ordering
isatest
parents:
13359
diff
changeset
|
130 |
echo "[...]" >> $TMP |
470daa444967
- changed date format for proper lexicographical ordering
isatest
parents:
13359
diff
changeset
|
131 |
tail -3 $L >> $TMP |
470daa444967
- changed date format for proper lexicographical ordering
isatest
parents:
13359
diff
changeset
|
132 |
echo >> $TMP |
470daa444967
- changed date format for proper lexicographical ordering
isatest
parents:
13359
diff
changeset
|
133 |
done |
470daa444967
- changed date format for proper lexicographical ordering
isatest
parents:
13359
diff
changeset
|
134 |
echo "Have a nice day," >> $TMP |
470daa444967
- changed date format for proper lexicographical ordering
isatest
parents:
13359
diff
changeset
|
135 |
echo " isatest" >> $TMP |
13320 | 136 |
|
137 |
for R in $MAILTO; do |
|
138 |
$MAIL "isabelle test failed" $R $TMP |
|
139 |
done |
|
140 |
||
141 |
rm $TMP |
|
142 |
||
13236 | 143 |
exit 1 |
144 |
else |
|
145 |
echo "$(date) $HOSTNAME $PRG: all tests successful, elapsed time $ELAPSED." >> $MASTERLOG |
|
146 |
fi |
|
147 |
||
148 |
# end |