author | wenzelm |
Sat, 11 Mar 2006 16:53:14 +0100 | |
changeset 19242 | 3c72963588c1 |
parent 18329 | 221d47d17a81 |
child 21038 | c7b041a6bbfe |
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 |
|
16095
f6af6b265d20
put global isatest settings in one file, sourced by the other scripts
kleing
parents:
15937
diff
changeset
|
9 |
## global settings |
f6af6b265d20
put global isatest settings in one file, sourced by the other scripts
kleing
parents:
15937
diff
changeset
|
10 |
. ~/admin/isatest-settings |
13986 | 11 |
|
14038 | 12 |
# produce empty list for patterns like isatest-*.log if no |
13 |
# such file exists |
|
14 |
shopt -s nullglob |
|
13986 | 15 |
|
16 |
# mail program |
|
17 |
MAIL=$HOME/bin/pmail |
|
18 |
||
19 |
# tmp file for sending mail |
|
20 |
TMP=/tmp/isatest-makedist.$$ |
|
21 |
||
16095
f6af6b265d20
put global isatest settings in one file, sourced by the other scripts
kleing
parents:
15937
diff
changeset
|
22 |
export DISTPREFIX |
f6af6b265d20
put global isatest settings in one file, sourced by the other scripts
kleing
parents:
15937
diff
changeset
|
23 |
|
13986 | 24 |
|
25 |
## diagnostics |
|
26 |
||
27 |
PRG="$(basename "$0")" |
|
28 |
||
29 |
function usage() |
|
30 |
{ |
|
31 |
echo |
|
32 |
echo "Usage: $PRG" |
|
33 |
echo |
|
13993
88a8911bb65d
only make development snapshots for successful tests
kleing
parents:
13992
diff
changeset
|
34 |
echo " sends email for failed tests, checks for error.log," |
88a8911bb65d
only make development snapshots for successful tests
kleing
parents:
13992
diff
changeset
|
35 |
echo " generates development snapshot if test ok." |
13986 | 36 |
echo " To be called by cron." |
37 |
echo |
|
38 |
exit 1 |
|
39 |
} |
|
40 |
||
41 |
function fail() |
|
42 |
{ |
|
43 |
echo "$1" >&2 |
|
44 |
exit 2 |
|
45 |
} |
|
46 |
||
47 |
## main |
|
48 |
||
17847 | 49 |
# check if tests are still running, wait for them a couple of hours |
13986 | 50 |
i=0 |
17847 | 51 |
while [ -n "$(ls $RUNNING)" -a $i -lt 8 ]; do |
13986 | 52 |
sleep 3600 |
13992 | 53 |
let "i = i+1" |
13986 | 54 |
done |
55 |
||
56 |
# still running -> give up |
|
13992 | 57 |
if [ -n "$(ls $RUNNING)" ]; then |
16178
754efc5afd5d
reduced timeout, send logs also when test taking too long
kleing
parents:
16095
diff
changeset
|
58 |
echo "Giving up waiting for test to finish at $(date)." > $TMP |
18244
694648741d5a
send more information with test-takes-too-long message
kleing
parents:
17847
diff
changeset
|
59 |
echo >> $TMP |
694648741d5a
send more information with test-takes-too-long message
kleing
parents:
17847
diff
changeset
|
60 |
echo "Sessions still running:" >> $TMP |
18329 | 61 |
echo "$(ls $RUNNING)" >> $TMP |
18244
694648741d5a
send more information with test-takes-too-long message
kleing
parents:
17847
diff
changeset
|
62 |
echo >> $TMP |
16507
ee552def8721
fix 'give up waiting message' (logs of running processes are not attached)
kleing
parents:
16362
diff
changeset
|
63 |
echo "Attaching all error logs collected so far." >> $TMP |
13986 | 64 |
echo >> $TMP |
16178
754efc5afd5d
reduced timeout, send logs also when test taking too long
kleing
parents:
16095
diff
changeset
|
65 |
|
754efc5afd5d
reduced timeout, send logs also when test taking too long
kleing
parents:
16095
diff
changeset
|
66 |
if [ -e $ERRORLOG ]; then |
754efc5afd5d
reduced timeout, send logs also when test taking too long
kleing
parents:
16095
diff
changeset
|
67 |
cat $ERRORLOG >> $TMP |
754efc5afd5d
reduced timeout, send logs also when test taking too long
kleing
parents:
16095
diff
changeset
|
68 |
fi |
754efc5afd5d
reduced timeout, send logs also when test taking too long
kleing
parents:
16095
diff
changeset
|
69 |
|
13986 | 70 |
echo "Have a nice day," >> $TMP |
71 |
echo " isatest" >> $TMP |
|
72 |
||
16178
754efc5afd5d
reduced timeout, send logs also when test taking too long
kleing
parents:
16095
diff
changeset
|
73 |
for R in $MAILTO; do |
754efc5afd5d
reduced timeout, send logs also when test taking too long
kleing
parents:
16095
diff
changeset
|
74 |
LOGS=$ERRORDIR/isatest*.log |
16362 | 75 |
$MAIL "isabelle test taking too long" $R $TMP $LOGS |
13986 | 76 |
done |
77 |
||
78 |
exit 1 |
|
79 |
fi |
|
80 |
||
81 |
# no tests running, check if there were errors |
|
82 |
if [ -e $ERRORLOG ]; then |
|
13992 | 83 |
cat $ERRORLOG > $TMP |
84 |
echo "Have a nice day," >> $TMP |
|
85 |
echo " isatest" >> $TMP |
|
13986 | 86 |
|
13992 | 87 |
for R in $MAILTO; do |
14038 | 88 |
LOGS=$ERRORDIR/isatest*.log |
14039 | 89 |
$MAIL "isabelle test failed" $R $TMP $LOGS |
13992 | 90 |
done |
13986 | 91 |
|
13992 | 92 |
rm $TMP |
93 |
exit 1 |
|
13986 | 94 |
fi |
95 |
||
13993
88a8911bb65d
only make development snapshots for successful tests
kleing
parents:
13992
diff
changeset
|
96 |
# generate development snapshot page only for successful tests |
88a8911bb65d
only make development snapshots for successful tests
kleing
parents:
13992
diff
changeset
|
97 |
(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
|
98 |
echo "$(date) $HOSTNAME $PRG: generated development snapshot web page." >> $MASTERLOG |
88a8911bb65d
only make development snapshots for successful tests
kleing
parents:
13992
diff
changeset
|
99 |
|
13992 | 100 |
exit 0 |
13986 | 101 |
## end |