author | webertj |
Fri, 26 Mar 2004 12:21:50 +0100 | |
changeset 14487 | 157d0ea7b2da |
parent 14170 | edd5a2ea3807 |
child 14981 | e73f8140af78 |
permissions | -rwxr-xr-x |
13986 | 1 |
#!/usr/bin/env bash |
2 |
# |
|
3 |
# $Id$ |
|
4 |
# Author: Gerwin Klein, TU Muenchen |
|
5 |
# License: GPL (GNU GENERAL PUBLIC LICENSE) |
|
6 |
# |
|
13993
88a8911bb65d
only make development snapshots for successful tests
kleing
parents:
13992
diff
changeset
|
7 |
# DESCRIPTION: sends email for failed tests, checks for error.log, |
88a8911bb65d
only make development snapshots for successful tests
kleing
parents:
13992
diff
changeset
|
8 |
# generates development snapshot if test ok |
13986 | 9 |
|
10 |
# source bashrc, we're called by cron |
|
11 |
. ~/.bashrc |
|
12 |
||
14038 | 13 |
# produce empty list for patterns like isatest-*.log if no |
14 |
# such file exists |
|
15 |
shopt -s nullglob |
|
13986 | 16 |
|
17 |
## global settings |
|
18 |
||
19 |
# send mail to: |
|
14170
edd5a2ea3807
Added skalberg to recepients, changed admin from kleing to berghofe.
skalberg
parents:
14039
diff
changeset
|
20 |
MAILTO="kleing@in.tum.de nipkow@in.tum.de berghofe@in.tum.de schirmer@in.tum.de lp15@cam.ac.uk skalberg@in.tum.de" |
13986 | 21 |
|
14170
edd5a2ea3807
Added skalberg to recepients, changed admin from kleing to berghofe.
skalberg
parents:
14039
diff
changeset
|
22 |
ADMIN="berghofe@in.tum.de" |
13986 | 23 |
|
24 |
# canoncical home for all platforms |
|
25 |
HOME=/usr/stud/isatest |
|
26 |
||
13993
88a8911bb65d
only make development snapshots for successful tests
kleing
parents:
13992
diff
changeset
|
27 |
# where to find the distribution |
88a8911bb65d
only make development snapshots for successful tests
kleing
parents:
13992
diff
changeset
|
28 |
DISTPREFIX=$HOME/isadist |
88a8911bb65d
only make development snapshots for successful tests
kleing
parents:
13992
diff
changeset
|
29 |
|
13986 | 30 |
# mail program |
31 |
MAIL=$HOME/bin/pmail |
|
32 |
||
13993
88a8911bb65d
only make development snapshots for successful tests
kleing
parents:
13992
diff
changeset
|
33 |
# where the logs are |
14035 | 34 |
ERRORDIR=$HOME/var |
35 |
ERRORLOG=$ERRORDIR/error.log |
|
13993
88a8911bb65d
only make development snapshots for successful tests
kleing
parents:
13992
diff
changeset
|
36 |
MASTERLOG=$HOME/log/isatest.log |
13986 | 37 |
|
38 |
# where the test-still-running files are |
|
13991 | 39 |
RUNNING=$HOME/var/running |
13986 | 40 |
|
41 |
# tmp file for sending mail |
|
42 |
TMP=/tmp/isatest-makedist.$$ |
|
43 |
||
44 |
||
45 |
## diagnostics |
|
46 |
||
47 |
PRG="$(basename "$0")" |
|
48 |
||
49 |
function usage() |
|
50 |
{ |
|
51 |
echo |
|
52 |
echo "Usage: $PRG" |
|
53 |
echo |
|
13993
88a8911bb65d
only make development snapshots for successful tests
kleing
parents:
13992
diff
changeset
|
54 |
echo " sends email for failed tests, checks for error.log," |
88a8911bb65d
only make development snapshots for successful tests
kleing
parents:
13992
diff
changeset
|
55 |
echo " generates development snapshot if test ok." |
13986 | 56 |
echo " To be called by cron." |
57 |
echo |
|
58 |
exit 1 |
|
59 |
} |
|
60 |
||
61 |
function fail() |
|
62 |
{ |
|
63 |
echo "$1" >&2 |
|
64 |
exit 2 |
|
65 |
} |
|
66 |
||
67 |
## main |
|
68 |
||
69 |
# check if tests are still running, wait for them to finish for max 10h |
|
70 |
i=0 |
|
13992 | 71 |
while [ -n "$(ls $RUNNING)" -a $i -lt 10 ]; do |
13986 | 72 |
sleep 3600 |
13992 | 73 |
let "i = i+1" |
13986 | 74 |
done |
75 |
||
76 |
# still running -> give up |
|
13992 | 77 |
if [ -n "$(ls $RUNNING)" ]; then |
13986 | 78 |
echo "giving up waiting for test to finish at $(date)" > $TMP |
79 |
echo >> $TMP |
|
80 |
echo "Have a nice day," >> $TMP |
|
81 |
echo " isatest" >> $TMP |
|
82 |
||
83 |
for R in $ADMIN; do |
|
13989 | 84 |
$MAIL "isabelle test taking to long" $R $TMP |
13986 | 85 |
done |
86 |
||
87 |
exit 1 |
|
88 |
fi |
|
89 |
||
90 |
# no tests running, check if there were errors |
|
91 |
if [ -e $ERRORLOG ]; then |
|
13992 | 92 |
cat $ERRORLOG > $TMP |
93 |
echo "Have a nice day," >> $TMP |
|
94 |
echo " isatest" >> $TMP |
|
13986 | 95 |
|
13992 | 96 |
for R in $MAILTO; do |
14038 | 97 |
LOGS=$ERRORDIR/isatest*.log |
14039 | 98 |
$MAIL "isabelle test failed" $R $TMP $LOGS |
13992 | 99 |
done |
13986 | 100 |
|
13992 | 101 |
rm $TMP |
102 |
exit 1 |
|
13986 | 103 |
fi |
104 |
||
13993
88a8911bb65d
only make development snapshots for successful tests
kleing
parents:
13992
diff
changeset
|
105 |
# generate development snapshot page only for successful tests |
88a8911bb65d
only make development snapshots for successful tests
kleing
parents:
13992
diff
changeset
|
106 |
(cd $HOME/devel-page; env DISTNAME=`$DISTPREFIX/Isabelle/bin/isatool version` make) |
88a8911bb65d
only make development snapshots for successful tests
kleing
parents:
13992
diff
changeset
|
107 |
echo "$(date) $HOSTNAME $PRG: generated development snapshot web page." >> $MASTERLOG |
88a8911bb65d
only make development snapshots for successful tests
kleing
parents:
13992
diff
changeset
|
108 |
|
13992 | 109 |
exit 0 |
13986 | 110 |
## end |