author | isatest |
Tue, 30 Jul 2002 10:29:34 +0200 | |
changeset 13432 | 470daa444967 |
parent 13359 | 982827aacb39 |
child 13838 | fe83f2231767 |
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 |
||
10 |
## global settings |
|
13359 | 11 |
MAILTO="kleing@in.tum.de nipkow@in.tum.de wenzelm@in.tum.de berghofe@in.tum.de schirmer@in.tum.de lp15@cam.ac.uk" |
13246 | 12 |
|
13232 | 13 |
LOGPREFIX=~/log |
13231 | 14 |
|
13236 | 15 |
MASTERLOG=$LOGPREFIX/isatest.log |
16 |
||
13320 | 17 |
TMP=/tmp/isatest-makeall.$$ |
18 |
||
19 |
MAIL=~/bin/pmail |
|
20 |
||
13231 | 21 |
## diagnostics |
22 |
||
23 |
PRG="$(basename "$0")" |
|
24 |
||
25 |
function usage() |
|
26 |
{ |
|
27 |
echo |
|
28 |
echo "Usage: $PRG distributionpath settings1 [settings2 ...]" |
|
29 |
echo |
|
30 |
echo " Run isatool makeall from specified distribution and settings." |
|
31 |
echo " Send email if it fails." |
|
32 |
echo |
|
33 |
exit 1 |
|
34 |
} |
|
35 |
||
36 |
function fail() |
|
37 |
{ |
|
38 |
echo "$1" >&2 |
|
39 |
exit 2 |
|
40 |
} |
|
41 |
||
42 |
## main |
|
43 |
||
44 |
# argument checking |
|
45 |
||
46 |
[ "$1" = "-?" ] && usage |
|
47 |
[ "$#" -lt "2" ] && usage |
|
48 |
||
49 |
DISTPREFIX=$1 |
|
50 |
shift |
|
51 |
||
52 |
[ -d $DISTPREFIX ] || fail "$DISTPREFIX is not a directory." |
|
53 |
||
13320 | 54 |
LOGS="" |
55 |
||
13231 | 56 |
for SETTINGS in $@; do |
57 |
||
58 |
[ -r $SETTINGS ] || fail "Cannot read $SETTINGS." |
|
59 |
||
60 |
||
61 |
# logfile setup |
|
62 |
||
13432
470daa444967
- changed date format for proper lexicographical ordering
isatest
parents:
13359
diff
changeset
|
63 |
DATE=$(date "+%Y-%m-%d") |
13231 | 64 |
SHORT=${SETTINGS##*/} |
65 |
TESTLOG=$LOGPREFIX/isatest-makeall-$SHORT-$DATE-$HOSTNAME.log |
|
66 |
||
67 |
# the test |
|
68 |
||
69 |
echo ------------------- starting test --- `date` --- $HOSTNAME > $TESTLOG 2>&1 |
|
70 |
||
13233 | 71 |
cat $SETTINGS >> $DISTPREFIX/Isabelle/etc/settings |
13320 | 72 |
nice $DISTPREFIX/Isabelle/bin/isatool makeall -j 2 all >> $TESTLOG 2>&1 |
13231 | 73 |
|
74 |
if [ $? -eq 0 ] |
|
75 |
then |
|
13236 | 76 |
echo ------------------- test successful --- `date` --- $HOSTNAME >> $TESTLOG 2>&1 |
13231 | 77 |
gzip -f $TESTLOG |
13246 | 78 |
rm -rf ~/isabelle-$SHORT |
13231 | 79 |
else |
80 |
echo ------------------- test FAILED --- `date` --- $HOSTNAME >> $TESTLOG 2>&1 |
|
13236 | 81 |
FAIL="$FAIL$SHORT " |
13432
470daa444967
- changed date format for proper lexicographical ordering
isatest
parents:
13359
diff
changeset
|
82 |
LOGS="${LOGS}$TESTLOG " |
13231 | 83 |
fi |
84 |
||
85 |
done |
|
86 |
||
13236 | 87 |
ELAPSED=$("$HOME/bin/showtime" "$SECONDS") |
88 |
||
89 |
if [ "$FAIL" != "" ]; then |
|
90 |
echo "$(date) $HOSTNAME $PRG: targets ${FAIL}FAILED, elapsed time $ELAPSED." >> $MASTERLOG |
|
13320 | 91 |
|
92 |
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
|
93 |
for L in $LOGS; do |
470daa444967
- changed date format for proper lexicographical ordering
isatest
parents:
13359
diff
changeset
|
94 |
echo "$HOSTNAME:$L" >> $TMP |
470daa444967
- changed date format for proper lexicographical ordering
isatest
parents:
13359
diff
changeset
|
95 |
echo "[...]" >> $TMP |
470daa444967
- changed date format for proper lexicographical ordering
isatest
parents:
13359
diff
changeset
|
96 |
tail -3 $L >> $TMP |
470daa444967
- changed date format for proper lexicographical ordering
isatest
parents:
13359
diff
changeset
|
97 |
echo >> $TMP |
470daa444967
- changed date format for proper lexicographical ordering
isatest
parents:
13359
diff
changeset
|
98 |
done |
470daa444967
- changed date format for proper lexicographical ordering
isatest
parents:
13359
diff
changeset
|
99 |
echo "Have a nice day," >> $TMP |
470daa444967
- changed date format for proper lexicographical ordering
isatest
parents:
13359
diff
changeset
|
100 |
echo " isatest" >> $TMP |
13320 | 101 |
|
102 |
for R in $MAILTO; do |
|
103 |
$MAIL "isabelle test failed" $R $TMP |
|
104 |
done |
|
105 |
||
106 |
rm $TMP |
|
107 |
||
13236 | 108 |
exit 1 |
109 |
else |
|
110 |
echo "$(date) $HOSTNAME $PRG: all tests successful, elapsed time $ELAPSED." >> $MASTERLOG |
|
111 |
fi |
|
112 |
||
113 |
# end |