author | wenzelm |
Thu, 01 Sep 2005 22:49:18 +0200 | |
changeset 17226 | 0687c76021c0 |
parent 16559 | 2916415680b9 |
child 17847 | 5d5cada76409 |
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 |
||
16559
2916415680b9
shortened time out by 3h (gives up at 12:00h now).
kleing
parents:
16507
diff
changeset
|
49 |
# check if tests are still running, wait for them to finish for max 5h |
13986 | 50 |
i=0 |
16559
2916415680b9
shortened time out by 3h (gives up at 12:00h now).
kleing
parents:
16507
diff
changeset
|
51 |
while [ -n "$(ls $RUNNING)" -a $i -lt 5 ]; 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 |
16507
ee552def8721
fix 'give up waiting message' (logs of running processes are not attached)
kleing
parents:
16362
diff
changeset
|
59 |
echo "Attaching all error logs collected so far." >> $TMP |
13986 | 60 |
echo >> $TMP |
16178
754efc5afd5d
reduced timeout, send logs also when test taking too long
kleing
parents:
16095
diff
changeset
|
61 |
|
754efc5afd5d
reduced timeout, send logs also when test taking too long
kleing
parents:
16095
diff
changeset
|
62 |
if [ -e $ERRORLOG ]; then |
754efc5afd5d
reduced timeout, send logs also when test taking too long
kleing
parents:
16095
diff
changeset
|
63 |
cat $ERRORLOG >> $TMP |
754efc5afd5d
reduced timeout, send logs also when test taking too long
kleing
parents:
16095
diff
changeset
|
64 |
fi |
754efc5afd5d
reduced timeout, send logs also when test taking too long
kleing
parents:
16095
diff
changeset
|
65 |
|
13986 | 66 |
echo "Have a nice day," >> $TMP |
67 |
echo " isatest" >> $TMP |
|
68 |
||
16178
754efc5afd5d
reduced timeout, send logs also when test taking too long
kleing
parents:
16095
diff
changeset
|
69 |
for R in $MAILTO; do |
754efc5afd5d
reduced timeout, send logs also when test taking too long
kleing
parents:
16095
diff
changeset
|
70 |
LOGS=$ERRORDIR/isatest*.log |
16362 | 71 |
$MAIL "isabelle test taking too long" $R $TMP $LOGS |
13986 | 72 |
done |
73 |
||
74 |
exit 1 |
|
75 |
fi |
|
76 |
||
77 |
# no tests running, check if there were errors |
|
78 |
if [ -e $ERRORLOG ]; then |
|
13992 | 79 |
cat $ERRORLOG > $TMP |
80 |
echo "Have a nice day," >> $TMP |
|
81 |
echo " isatest" >> $TMP |
|
13986 | 82 |
|
13992 | 83 |
for R in $MAILTO; do |
14038 | 84 |
LOGS=$ERRORDIR/isatest*.log |
14039 | 85 |
$MAIL "isabelle test failed" $R $TMP $LOGS |
13992 | 86 |
done |
13986 | 87 |
|
13992 | 88 |
rm $TMP |
89 |
exit 1 |
|
13986 | 90 |
fi |
91 |
||
13993
88a8911bb65d
only make development snapshots for successful tests
kleing
parents:
13992
diff
changeset
|
92 |
# generate development snapshot page only for successful tests |
88a8911bb65d
only make development snapshots for successful tests
kleing
parents:
13992
diff
changeset
|
93 |
(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
|
94 |
echo "$(date) $HOSTNAME $PRG: generated development snapshot web page." >> $MASTERLOG |
88a8911bb65d
only make development snapshots for successful tests
kleing
parents:
13992
diff
changeset
|
95 |
|
13992 | 96 |
exit 0 |
13986 | 97 |
## end |