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