author | kleing |
Fri, 09 May 2003 14:15:50 +0200 | |
changeset 13993 | 88a8911bb65d |
parent 13992 | 93769c6c85d7 |
child 14035 | c46ce87960fb |
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 |
||
13 |
||
14 |
## global settings |
|
15 |
||
16 |
# send mail to: |
|
17 |
MAILTO="kleing@in.tum.de nipkow@in.tum.de berghofe@in.tum.de schirmer@in.tum.de lp15@cam.ac.uk" |
|
18 |
||
19 |
ADMIN="kleing@in.tum.de" |
|
20 |
||
21 |
# canoncical home for all platforms |
|
22 |
HOME=/usr/stud/isatest |
|
23 |
||
13993
88a8911bb65d
only make development snapshots for successful tests
kleing
parents:
13992
diff
changeset
|
24 |
# where to find the distribution |
88a8911bb65d
only make development snapshots for successful tests
kleing
parents:
13992
diff
changeset
|
25 |
DISTPREFIX=$HOME/isadist |
88a8911bb65d
only make development snapshots for successful tests
kleing
parents:
13992
diff
changeset
|
26 |
|
13986 | 27 |
# mail program |
28 |
MAIL=$HOME/bin/pmail |
|
29 |
||
13993
88a8911bb65d
only make development snapshots for successful tests
kleing
parents:
13992
diff
changeset
|
30 |
# where the logs are |
13986 | 31 |
ERRORLOG=$HOME/var/error.log |
13993
88a8911bb65d
only make development snapshots for successful tests
kleing
parents:
13992
diff
changeset
|
32 |
MASTERLOG=$HOME/log/isatest.log |
13986 | 33 |
|
34 |
# where the test-still-running files are |
|
13991 | 35 |
RUNNING=$HOME/var/running |
13986 | 36 |
|
37 |
# tmp file for sending mail |
|
38 |
TMP=/tmp/isatest-makedist.$$ |
|
39 |
||
40 |
||
41 |
## diagnostics |
|
42 |
||
43 |
PRG="$(basename "$0")" |
|
44 |
||
45 |
function usage() |
|
46 |
{ |
|
47 |
echo |
|
48 |
echo "Usage: $PRG" |
|
49 |
echo |
|
13993
88a8911bb65d
only make development snapshots for successful tests
kleing
parents:
13992
diff
changeset
|
50 |
echo " sends email for failed tests, checks for error.log," |
88a8911bb65d
only make development snapshots for successful tests
kleing
parents:
13992
diff
changeset
|
51 |
echo " generates development snapshot if test ok." |
13986 | 52 |
echo " To be called by cron." |
53 |
echo |
|
54 |
exit 1 |
|
55 |
} |
|
56 |
||
57 |
function fail() |
|
58 |
{ |
|
59 |
echo "$1" >&2 |
|
60 |
exit 2 |
|
61 |
} |
|
62 |
||
63 |
## main |
|
64 |
||
65 |
# check if tests are still running, wait for them to finish for max 10h |
|
66 |
i=0 |
|
13992 | 67 |
while [ -n "$(ls $RUNNING)" -a $i -lt 10 ]; do |
13986 | 68 |
sleep 3600 |
13992 | 69 |
let "i = i+1" |
13986 | 70 |
done |
71 |
||
72 |
# still running -> give up |
|
13992 | 73 |
if [ -n "$(ls $RUNNING)" ]; then |
13986 | 74 |
echo "giving up waiting for test to finish at $(date)" > $TMP |
75 |
echo >> $TMP |
|
76 |
echo "Have a nice day," >> $TMP |
|
77 |
echo " isatest" >> $TMP |
|
78 |
||
79 |
for R in $ADMIN; do |
|
13989 | 80 |
$MAIL "isabelle test taking to long" $R $TMP |
13986 | 81 |
done |
82 |
||
83 |
exit 1 |
|
84 |
fi |
|
85 |
||
86 |
# no tests running, check if there were errors |
|
87 |
if [ -e $ERRORLOG ]; then |
|
13992 | 88 |
cat $ERRORLOG > $TMP |
89 |
echo "Have a nice day," >> $TMP |
|
90 |
echo " isatest" >> $TMP |
|
13986 | 91 |
|
13992 | 92 |
for R in $MAILTO; do |
93 |
$MAIL "isabelle test failed" $R $TMP |
|
94 |
done |
|
13986 | 95 |
|
13992 | 96 |
rm $TMP |
97 |
exit 1 |
|
13986 | 98 |
fi |
99 |
||
13993
88a8911bb65d
only make development snapshots for successful tests
kleing
parents:
13992
diff
changeset
|
100 |
# generate development snapshot page only for successful tests |
88a8911bb65d
only make development snapshots for successful tests
kleing
parents:
13992
diff
changeset
|
101 |
(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
|
102 |
echo "$(date) $HOSTNAME $PRG: generated development snapshot web page." >> $MASTERLOG |
88a8911bb65d
only make development snapshots for successful tests
kleing
parents:
13992
diff
changeset
|
103 |
|
13992 | 104 |
exit 0 |
13986 | 105 |
## end |