author | wenzelm |
Sat, 06 Jun 2009 23:43:07 +0200 | |
changeset 31496 | c4b74075fc17 |
parent 28982 | 75f221d67515 |
child 31581 | 907616b9536c |
permissions | -rwxr-xr-x |
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
1 |
#!/usr/bin/env bash |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
2 |
# |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
3 |
# $Id$ |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
4 |
# Author: Gerwin Klein, TU Muenchen |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
5 |
# |
28504
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents:
28500
diff
changeset
|
6 |
# DESCRIPTION: Run isabelle makeall from specified distribution and settings. |
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
7 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
8 |
## global settings |
22411 | 9 |
. ~/admin/isatest/isatest-settings |
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
10 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
11 |
# max time until test is aborted (in sec) |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
12 |
MAXTIME=28800 |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
13 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
14 |
## diagnostics |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
15 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
16 |
PRG="$(basename "$0")" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
17 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
18 |
function usage() |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
19 |
{ |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
20 |
echo |
24753 | 21 |
echo "Usage: $PRG [-l logic targets] settings1 [settings2 ...]" |
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
22 |
echo |
28504
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents:
28500
diff
changeset
|
23 |
echo " Runs isabelle makeall for specified settings." |
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
24 |
echo " Leaves messages in ${ERRORLOG} and ${LOGPREFIX} if it fails." |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
25 |
echo |
24753 | 26 |
echo "Examples:" |
27 |
echo " $PRG ~/settings/at-poly ~/settings/at-sml" |
|
28 |
echo " $PRG -l HOL \"HOL-Library HOL-Bali\" ~/settings/at-poly" |
|
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
29 |
exit 1 |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
30 |
} |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
31 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
32 |
function fail() |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
33 |
{ |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
34 |
echo "$1" >&2 |
28539
bdb308737bfd
do logging to MASTERLOG centrally (avoid multiple writers over NFS as
kleing
parents:
28527
diff
changeset
|
35 |
log "FAILED, $1" |
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
36 |
exit 2 |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
37 |
} |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
38 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
39 |
## main |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
40 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
41 |
# argument checking |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
42 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
43 |
[ "$1" = "-?" ] && usage |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
44 |
[ "$#" -lt "1" ] && usage |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
45 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
46 |
[ -d $DISTPREFIX ] || fail "$DISTPREFIX is not a directory." |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
47 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
48 |
# make file flags and nice setup for different target platforms |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
49 |
case $HOSTNAME in |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
50 |
atbroy51) |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
51 |
MFLAGS="-j 2" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
52 |
NICE="" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
53 |
;; |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
54 |
|
24758 | 55 |
atbroy98) |
26369 | 56 |
MFLAGS="" |
57 |
NICE="" |
|
58 |
;; |
|
24647 | 59 |
|
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
60 |
atbroy31) |
26369 | 61 |
MFLAGS="-j 2" |
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
62 |
;; |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
63 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
64 |
sunbroy2) |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
65 |
MFLAGS="-j 6" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
66 |
NICE="nice" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
67 |
;; |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
68 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
69 |
sunbroy1) |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
70 |
MFLAGS="-j 2" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
71 |
NICE="nice" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
72 |
;; |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
73 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
74 |
macbroy5) |
23415 | 75 |
MFLAGS="-j 2" |
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
76 |
NICE="" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
77 |
;; |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
78 |
|
31496
c4b74075fc17
no parallel make jobs on macbroy23, which is the machine where SML/XL is tested -- attempt to consume less resources;
wenzelm
parents:
28982
diff
changeset
|
79 |
macbroy23) |
c4b74075fc17
no parallel make jobs on macbroy23, which is the machine where SML/XL is tested -- attempt to consume less resources;
wenzelm
parents:
28982
diff
changeset
|
80 |
MFLAGS="" |
c4b74075fc17
no parallel make jobs on macbroy23, which is the machine where SML/XL is tested -- attempt to consume less resources;
wenzelm
parents:
28982
diff
changeset
|
81 |
NICE="" |
c4b74075fc17
no parallel make jobs on macbroy23, which is the machine where SML/XL is tested -- attempt to consume less resources;
wenzelm
parents:
28982
diff
changeset
|
82 |
;; |
c4b74075fc17
no parallel make jobs on macbroy23, which is the machine where SML/XL is tested -- attempt to consume less resources;
wenzelm
parents:
28982
diff
changeset
|
83 |
|
26369 | 84 |
macbroy2[0-9]) |
85 |
MFLAGS="-j 2" |
|
86 |
NICE="" |
|
87 |
;; |
|
88 |
||
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
89 |
*) |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
90 |
MFLAGS="" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
91 |
# be nice by default |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
92 |
NICE=nice |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
93 |
;; |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
94 |
esac |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
95 |
|
28504
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents:
28500
diff
changeset
|
96 |
ISABELLE_TOOL="$DISTPREFIX/Isabelle/bin/isabelle" |
24753 | 97 |
|
28500 | 98 |
[ -x $ISABELLE_TOOL ] || fail "Cannot run $ISABELLE_TOOL" |
24753 | 99 |
|
100 |
if [ "$1" = "-l" ]; then |
|
101 |
shift |
|
102 |
[ "$#" -lt "3" ] && usage |
|
103 |
LOGIC="$1" |
|
104 |
TARGETS="$2" |
|
105 |
shift 2 |
|
28500 | 106 |
ISABELLE_HOME="$($ISABELLE_TOOL getenv -b ISABELLE_HOME)" |
24786 | 107 |
DIR="$ISABELLE_HOME/src/$LOGIC" |
28500 | 108 |
TOOL="$ISABELLE_TOOL make $MFLAGS $TARGETS" |
24753 | 109 |
else |
24781 | 110 |
DIR="." |
28500 | 111 |
TOOL="$ISABELLE_TOOL makeall $MFLAGS all" |
24753 | 112 |
fi |
113 |
||
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
114 |
# main test loop |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
115 |
|
28597 | 116 |
log "starting [$@]" |
117 |
||
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
118 |
for SETTINGS in $@; do |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
119 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
120 |
[ -r $SETTINGS ] || fail "Cannot read $SETTINGS." |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
121 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
122 |
# logfile setup |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
123 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
124 |
DATE=$(date "+%Y-%m-%d") |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
125 |
SHORT=${SETTINGS##*/} |
28527
82b36daff4c1
make the test for experimental sessions in isatest-check actually work
kleing
parents:
28504
diff
changeset
|
126 |
|
82b36daff4c1
make the test for experimental sessions in isatest-check actually work
kleing
parents:
28504
diff
changeset
|
127 |
if [ "${SHORT%-e}" == "$SHORT" ]; then |
82b36daff4c1
make the test for experimental sessions in isatest-check actually work
kleing
parents:
28504
diff
changeset
|
128 |
# normal test |
82b36daff4c1
make the test for experimental sessions in isatest-check actually work
kleing
parents:
28504
diff
changeset
|
129 |
TESTLOG=$LOGPREFIX/isatest-makeall-$SHORT-$DATE-$HOSTNAME.log |
82b36daff4c1
make the test for experimental sessions in isatest-check actually work
kleing
parents:
28504
diff
changeset
|
130 |
else |
82b36daff4c1
make the test for experimental sessions in isatest-check actually work
kleing
parents:
28504
diff
changeset
|
131 |
# experimental test |
82b36daff4c1
make the test for experimental sessions in isatest-check actually work
kleing
parents:
28504
diff
changeset
|
132 |
TESTLOG=$LOGPREFIX/isatest-makeall-$SHORT-$DATE-$HOSTNAME-e.log |
82b36daff4c1
make the test for experimental sessions in isatest-check actually work
kleing
parents:
28504
diff
changeset
|
133 |
fi |
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
134 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
135 |
# the test |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
136 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
137 |
touch $RUNNING/$SHORT.running |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
138 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
139 |
echo ------------------- starting test --- `date` --- $HOSTNAME > $TESTLOG 2>&1 |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
140 |
|
28982 | 141 |
if [ "${ISABELLE_HOME_USER:0:14}" == "/tmp/isabelle-" ]; then |
142 |
echo "--- cleaning up old $ISABELLE_HOME_USER" |
|
143 |
rm -rf $ISABELLE_HOME_USER |
|
144 |
fi |
|
145 |
||
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
146 |
cat $SETTINGS >> $DISTPREFIX/Isabelle/etc/settings |
24781 | 147 |
(ulimit -t $MAXTIME; cd $DIR; $NICE $TOOL >> $TESTLOG 2>&1) |
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
148 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
149 |
if [ $? -eq 0 ] |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
150 |
then |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
151 |
# test log and cleanup |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
152 |
echo ------------------- test successful --- `date` --- $HOSTNAME >> $TESTLOG 2>&1 |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
153 |
gzip -f $TESTLOG |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
154 |
else |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
155 |
# test log |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
156 |
echo ------------------- test FAILED --- `date` --- $HOSTNAME >> $TESTLOG 2>&1 |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
157 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
158 |
# error log |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
159 |
echo "Test for platform ${SHORT} failed. Log file attached." >> $ERRORLOG |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
160 |
echo "[...]" >> $ERRORLOG |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
161 |
tail -3 $TESTLOG >> $ERRORLOG |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
162 |
echo >> $ERRORLOG |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
163 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
164 |
FAIL="$FAIL$SHORT " |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
165 |
(cd $ERRORDIR; ln -s $TESTLOG) |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
166 |
fi |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
167 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
168 |
rm -f $RUNNING/$SHORT.running |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
169 |
done |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
170 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
171 |
# time and success/failure to master log |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
172 |
ELAPSED=$("$HOME/bin/showtime" "$SECONDS") |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
173 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
174 |
if [ -z "$FAIL" ]; then |
28539
bdb308737bfd
do logging to MASTERLOG centrally (avoid multiple writers over NFS as
kleing
parents:
28527
diff
changeset
|
175 |
log "all tests successful, elapsed time $ELAPSED." |
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
176 |
else |
28539
bdb308737bfd
do logging to MASTERLOG centrally (avoid multiple writers over NFS as
kleing
parents:
28527
diff
changeset
|
177 |
log "targets ${FAIL}FAILED, elapsed time $ELAPSED." |
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
178 |
exit 1 |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
179 |
fi |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
180 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
181 |
# end |