author | haftmann |
Sat, 17 Oct 2015 16:08:30 +0200 | |
changeset 61468 | 7d1127ac2251 |
parent 60726 | 6d500a224cbe |
child 62354 | fdd6989cc8a0 |
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 |
# Author: Gerwin Klein, TU Muenchen |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
4 |
# |
48608
88ff12baccba
updated isatest to isabelle build, which also includes doc-src sessions;
wenzelm
parents:
48259
diff
changeset
|
5 |
# DESCRIPTION: Run isabelle build from specified distribution and settings. |
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
6 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
7 |
## global settings |
22411 | 8 |
. ~/admin/isatest/isatest-settings |
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
9 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
10 |
# max time until test is aborted (in sec) |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
11 |
MAXTIME=28800 |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
12 |
|
48259 | 13 |
|
22410
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 |
60724
4fce5d462afc
more explicit command-line option for isabelle build;
wenzelm
parents:
60713
diff
changeset
|
21 |
echo "Usage: $PRG [-x SESSION] [-l SESSIONS] settings1 [settings2 ...]" |
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
22 |
echo |
48608
88ff12baccba
updated isatest to isabelle build, which also includes doc-src sessions;
wenzelm
parents:
48259
diff
changeset
|
23 |
echo " Runs isabelle build 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" |
|
48608
88ff12baccba
updated isatest to isabelle build, which also includes doc-src sessions;
wenzelm
parents:
48259
diff
changeset
|
28 |
echo " $PRG -l \"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 |
|
48259 | 39 |
|
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
40 |
## main |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
41 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
42 |
# argument checking |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
43 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
44 |
[ "$1" = "-?" ] && usage |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
45 |
[ "$#" -lt "1" ] && usage |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
46 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
47 |
[ -d $DISTPREFIX ] || fail "$DISTPREFIX is not a directory." |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
48 |
|
48608
88ff12baccba
updated isatest to isabelle build, which also includes doc-src sessions;
wenzelm
parents:
48259
diff
changeset
|
49 |
# build args and nice setup for different target platforms |
50149
aaf276a28551
more generous timeout for SML/NJ, which is approx. 40-80 times slower than Poly/ML;
wenzelm
parents:
50129
diff
changeset
|
50 |
BUILD_ARGS="-v" |
48259 | 51 |
NICE="nice" |
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
52 |
case $HOSTNAME in |
48259 | 53 |
macbroy2 | macbroy6 | macbroy30) |
31581 | 54 |
NICE="" |
55 |
;; |
|
48158
68a32e12b999
more tests on lxbroy[234], which are 4 core Xeon machines;
wenzelm
parents:
48147
diff
changeset
|
56 |
lxbroy[234]) |
48608
88ff12baccba
updated isatest to isabelle build, which also includes doc-src sessions;
wenzelm
parents:
48259
diff
changeset
|
57 |
BUILD_ARGS="$BUILD_ARGS -j 2" |
48158
68a32e12b999
more tests on lxbroy[234], which are 4 core Xeon machines;
wenzelm
parents:
48147
diff
changeset
|
58 |
NICE="" |
68a32e12b999
more tests on lxbroy[234], which are 4 core Xeon machines;
wenzelm
parents:
48147
diff
changeset
|
59 |
;; |
68a32e12b999
more tests on lxbroy[234], which are 4 core Xeon machines;
wenzelm
parents:
48147
diff
changeset
|
60 |
|
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
61 |
esac |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
62 |
|
28504
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents:
28500
diff
changeset
|
63 |
ISABELLE_TOOL="$DISTPREFIX/Isabelle/bin/isabelle" |
48608
88ff12baccba
updated isatest to isabelle build, which also includes doc-src sessions;
wenzelm
parents:
48259
diff
changeset
|
64 |
[ -x $ISABELLE_TOOL ] || fail "Cannot run $ISABELLE_TOOL" |
24753 | 65 |
|
48608
88ff12baccba
updated isatest to isabelle build, which also includes doc-src sessions;
wenzelm
parents:
48259
diff
changeset
|
66 |
ISABELLE_HOME="$($ISABELLE_TOOL getenv -b ISABELLE_HOME)" |
24753 | 67 |
|
60724
4fce5d462afc
more explicit command-line option for isabelle build;
wenzelm
parents:
60713
diff
changeset
|
68 |
if [ "$1" = "-x" ]; then |
4fce5d462afc
more explicit command-line option for isabelle build;
wenzelm
parents:
60713
diff
changeset
|
69 |
shift |
4fce5d462afc
more explicit command-line option for isabelle build;
wenzelm
parents:
60713
diff
changeset
|
70 |
[ "$#" -lt 2 ] && usage |
60726
6d500a224cbe
back to uniform BUILD_ARGS: first some options, then some sessions (cf. 4fce5d462afc);
wenzelm
parents:
60724
diff
changeset
|
71 |
BUILD_ARGS="$BUILD_ARGS -x $1" |
60724
4fce5d462afc
more explicit command-line option for isabelle build;
wenzelm
parents:
60713
diff
changeset
|
72 |
shift |
4fce5d462afc
more explicit command-line option for isabelle build;
wenzelm
parents:
60713
diff
changeset
|
73 |
fi |
4fce5d462afc
more explicit command-line option for isabelle build;
wenzelm
parents:
60713
diff
changeset
|
74 |
|
24753 | 75 |
if [ "$1" = "-l" ]; then |
76 |
shift |
|
48608
88ff12baccba
updated isatest to isabelle build, which also includes doc-src sessions;
wenzelm
parents:
48259
diff
changeset
|
77 |
[ "$#" -lt 2 ] && usage |
88ff12baccba
updated isatest to isabelle build, which also includes doc-src sessions;
wenzelm
parents:
48259
diff
changeset
|
78 |
BUILD_ARGS="$BUILD_ARGS $1" |
88ff12baccba
updated isatest to isabelle build, which also includes doc-src sessions;
wenzelm
parents:
48259
diff
changeset
|
79 |
shift |
24753 | 80 |
else |
48608
88ff12baccba
updated isatest to isabelle build, which also includes doc-src sessions;
wenzelm
parents:
48259
diff
changeset
|
81 |
BUILD_ARGS="$BUILD_ARGS -a" |
24753 | 82 |
fi |
83 |
||
32505
eb82ed858b84
isatest: collect test results and logs in testdata repository
krauss
parents:
32418
diff
changeset
|
84 |
IDENT=$(cat "$DISTPREFIX/ISABELLE_IDENT") |
eb82ed858b84
isatest: collect test results and logs in testdata repository
krauss
parents:
32418
diff
changeset
|
85 |
|
48259 | 86 |
|
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
87 |
# main test loop |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
88 |
|
28597 | 89 |
log "starting [$@]" |
90 |
||
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
91 |
for SETTINGS in $@; do |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
92 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
93 |
[ -r $SETTINGS ] || fail "Cannot read $SETTINGS." |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
94 |
|
50149
aaf276a28551
more generous timeout for SML/NJ, which is approx. 40-80 times slower than Poly/ML;
wenzelm
parents:
50129
diff
changeset
|
95 |
case "$SETTINGS" in |
aaf276a28551
more generous timeout for SML/NJ, which is approx. 40-80 times slower than Poly/ML;
wenzelm
parents:
50129
diff
changeset
|
96 |
*sml*) |
59161
5a13df748fac
more generous timeout, to increase chances of at64-poly;
wenzelm
parents:
58423
diff
changeset
|
97 |
BUILD_ARGS="-o timeout=72000 $BUILD_ARGS" |
50149
aaf276a28551
more generous timeout for SML/NJ, which is approx. 40-80 times slower than Poly/ML;
wenzelm
parents:
50129
diff
changeset
|
98 |
;; |
aaf276a28551
more generous timeout for SML/NJ, which is approx. 40-80 times slower than Poly/ML;
wenzelm
parents:
50129
diff
changeset
|
99 |
*) |
60713
5240b2ed5189
refrain from testing HOL-Proofs for x86_64-linux: takes more than 4h;
wenzelm
parents:
60684
diff
changeset
|
100 |
BUILD_ARGS="-o timeout=10800 $BUILD_ARGS" |
50149
aaf276a28551
more generous timeout for SML/NJ, which is approx. 40-80 times slower than Poly/ML;
wenzelm
parents:
50129
diff
changeset
|
101 |
;; |
aaf276a28551
more generous timeout for SML/NJ, which is approx. 40-80 times slower than Poly/ML;
wenzelm
parents:
50129
diff
changeset
|
102 |
esac |
aaf276a28551
more generous timeout for SML/NJ, which is approx. 40-80 times slower than Poly/ML;
wenzelm
parents:
50129
diff
changeset
|
103 |
|
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
104 |
# logfile setup |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
105 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
106 |
DATE=$(date "+%Y-%m-%d") |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
107 |
SHORT=${SETTINGS##*/} |
28527
82b36daff4c1
make the test for experimental sessions in isatest-check actually work
kleing
parents:
28504
diff
changeset
|
108 |
|
48259 | 109 |
if [ "${SHORT%-e}" == "$SHORT" ]; then |
110 |
# normal test |
|
111 |
TESTLOG=$LOGPREFIX/isatest-makeall-$SHORT-$DATE-$HOSTNAME.log |
|
112 |
else |
|
113 |
# experimental test |
|
114 |
TESTLOG=$LOGPREFIX/isatest-makeall-$SHORT-$DATE-$HOSTNAME-e.log |
|
115 |
fi |
|
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
116 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
117 |
# the test |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
118 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
119 |
touch $RUNNING/$SHORT.running |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
120 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
121 |
echo ------------------- starting test --- `date` --- $HOSTNAME > $TESTLOG 2>&1 |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
122 |
|
39686 | 123 |
echo "Isabelle version: $IDENT" >> $TESTLOG 2>&1 |
124 |
||
28982 | 125 |
if [ "${ISABELLE_HOME_USER:0:14}" == "/tmp/isabelle-" ]; then |
126 |
echo "--- cleaning up old $ISABELLE_HOME_USER" |
|
127 |
rm -rf $ISABELLE_HOME_USER |
|
128 |
fi |
|
129 |
||
41967
6aa69999da8f
isatest: fresh copy of settings avoids odd cumulative environment;
wenzelm
parents:
39686
diff
changeset
|
130 |
cp $DISTPREFIX/Isabelle/etc/settings.orig $DISTPREFIX/Isabelle/etc/settings |
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
131 |
cat $SETTINGS >> $DISTPREFIX/Isabelle/etc/settings |
60726
6d500a224cbe
back to uniform BUILD_ARGS: first some options, then some sessions (cf. 4fce5d462afc);
wenzelm
parents:
60724
diff
changeset
|
132 |
(ulimit -t $MAXTIME; $NICE "$ISABELLE_TOOL" build $BUILD_ARGS >> $TESTLOG 2>&1) |
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
133 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
134 |
if [ $? -eq 0 ] |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
135 |
then |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
136 |
# test log and cleanup |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
137 |
echo ------------------- test successful --- `date` --- $HOSTNAME >> $TESTLOG 2>&1 |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
138 |
gzip -f $TESTLOG |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
139 |
else |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
140 |
# test log |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
141 |
echo ------------------- test FAILED --- `date` --- $HOSTNAME >> $TESTLOG 2>&1 |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
142 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
143 |
# error log |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
144 |
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
|
145 |
echo "[...]" >> $ERRORLOG |
49978
c163145dd40f
longer log, to accomodate final status line of isabelle build;
wenzelm
parents:
48608
diff
changeset
|
146 |
tail -4 $TESTLOG >> $ERRORLOG |
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
147 |
echo >> $ERRORLOG |
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 |
FAIL="$FAIL$SHORT " |
38434 | 150 |
(cd $ERRORDIR; cp $TESTLOG .) |
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
151 |
fi |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
152 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
153 |
rm -f $RUNNING/$SHORT.running |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
154 |
done |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
155 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
156 |
# time and success/failure to master log |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
157 |
ELAPSED=$("$HOME/bin/showtime" "$SECONDS") |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
158 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
159 |
if [ -z "$FAIL" ]; then |
28539
bdb308737bfd
do logging to MASTERLOG centrally (avoid multiple writers over NFS as
kleing
parents:
28527
diff
changeset
|
160 |
log "all tests successful, elapsed time $ELAPSED." |
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
161 |
else |
28539
bdb308737bfd
do logging to MASTERLOG centrally (avoid multiple writers over NFS as
kleing
parents:
28527
diff
changeset
|
162 |
log "targets ${FAIL}FAILED, elapsed time $ELAPSED." |
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
163 |
exit 1 |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
164 |
fi |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
165 |