13231
|
1 |
#!/usr/bin/env bash
|
|
2 |
#
|
|
3 |
# $Id$
|
|
4 |
# Author: Gerwin Klein, TU Muenchen
|
|
5 |
# License: GPL (GNU GENERAL PUBLIC LICENSE)
|
|
6 |
#
|
|
7 |
# DESCRIPTION: Run isatool makeall from specified distribution and settings.
|
|
8 |
# Send email if it fails.
|
|
9 |
|
|
10 |
## global settings
|
|
11 |
LOGPREFIX=~
|
|
12 |
|
|
13 |
## diagnostics
|
|
14 |
|
|
15 |
PRG="$(basename "$0")"
|
|
16 |
|
|
17 |
function usage()
|
|
18 |
{
|
|
19 |
echo
|
|
20 |
echo "Usage: $PRG distributionpath settings1 [settings2 ...]"
|
|
21 |
echo
|
|
22 |
echo " Run isatool makeall from specified distribution and settings."
|
|
23 |
echo " Send email if it fails."
|
|
24 |
echo
|
|
25 |
exit 1
|
|
26 |
}
|
|
27 |
|
|
28 |
function fail()
|
|
29 |
{
|
|
30 |
echo "$1" >&2
|
|
31 |
exit 2
|
|
32 |
}
|
|
33 |
|
|
34 |
## main
|
|
35 |
|
|
36 |
# argument checking
|
|
37 |
|
|
38 |
[ "$1" = "-?" ] && usage
|
|
39 |
[ "$#" -lt "2" ] && usage
|
|
40 |
|
|
41 |
DISTPREFIX=$1
|
|
42 |
shift
|
|
43 |
|
|
44 |
[ -d $DISTPREFIX ] || fail "$DISTPREFIX is not a directory."
|
|
45 |
|
|
46 |
for SETTINGS in $@; do
|
|
47 |
|
|
48 |
[ -r $SETTINGS ] || fail "Cannot read $SETTINGS."
|
|
49 |
|
|
50 |
|
|
51 |
# logfile setup
|
|
52 |
|
|
53 |
DATE=$(date "+%d-%b-%Y")
|
|
54 |
SHORT=${SETTINGS##*/}
|
|
55 |
TESTLOG=$LOGPREFIX/isatest-makeall-$SHORT-$DATE-$HOSTNAME.log
|
|
56 |
|
|
57 |
# the test
|
|
58 |
|
|
59 |
echo ------------------- starting test --- `date` --- $HOSTNAME > $TESTLOG 2>&1
|
|
60 |
|
|
61 |
cp -v $SETTINGS $DISTPREFIX/Isabelle/etc/settings >> $TESTLOG 2>&1
|
|
62 |
$DISTPREFIX/Isabelle/bin/isatool makeall all >> $TESTLOG 2>&1
|
|
63 |
|
|
64 |
if [ $? -eq 0 ]
|
|
65 |
then
|
|
66 |
echo ------------------- test successfull --- `date` --- $HOSTNAME >> $TESTLOG 2>&1
|
|
67 |
gzip -f $TESTLOG
|
|
68 |
else
|
|
69 |
echo ------------------- test FAILED --- `date` --- $HOSTNAME >> $TESTLOG 2>&1
|
|
70 |
# more action here
|
|
71 |
exit 1
|
|
72 |
fi
|
|
73 |
|
|
74 |
done
|
|
75 |
|
|
76 |
# end |