blob: 32ab8870918b2d2b6d0dd306f614d33f9916943b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
|
#!/bin/sh
# This script automatically test the given tool with the tool's test cases,
# reporting anything of interest.
# exits with 1 if there is nothing of interest
# exits with 0 if there is something interesting
# exits with 2 if an error occurred
# Syntax: test-tool [-expectedpass] [-keepoutput] [-noupdate] g++|gcc|gdb|...
#
# -expectedpass: Turn XFAIL into "pass", XPASS into "fail".
# The default is XFAIL->fail, XPASS->pass.
# -keepoutput: Save "make check" output in test-$tool.log.
# -noupdate: Don't update log files.
# Limitations, don't run this multiple times in one day, unless the -noupdate
# flag is given.
# Written by Mike Stump <mrs@cygnus.com>
expectedpass=no
keepoutput=no
update=yes
tool=""
# See if cp -p works.
pwd=`pwd`
cd /tmp
rm -f test-tool-$$-1 test-tool-$$-2
touch test-tool-$$-1
cp -p test-tool-$$-1 test-tool-$$-2 2>/dev/null
if [ $? = 0 -a -f test-tool-$$-2 ] ; then
CP="cp -p"
else
CP=cp
fi
rm -f test-tool-$$-1 test-tool-$$-2
cd $pwd
for arg in $*
do
case $arg in
-expectedpass) expectedpass=yes ;;
-keepoutput) keepoutput=yes ;;
-noupdate) update=no ;;
-*)
echo "Usage: [-expectedpass] [-keepoutput] [-noupdate] tool_name" >&2
exit 2
;;
*)
if [ "$tool" != "" ]; then
echo "Usage: [-expectedpass] [-keepoutput] [-noupdate] tool_name" >&2
exit 2
fi
tool=$arg
;;
esac
done
# FIXME: It sure would be nice if `testdir' wasn't necessary. :-(
case $tool in
g++)
devoname=gcc
checktarget=check-g++
testdir=testsuite
;;
gcc)
devoname=gcc
checktarget=check-gcc
testdir=testsuite
;;
ld|gld)
devoname=ld
checktarget=check
testdir=.
;;
binutils)
devoname=binutils
checktarget=check
testdir=.
;;
*)
devoname=$tool
checktarget=check
testdir=testsuite
;;
esac
# Default DEVOSRCDIR
if [ "$DEVOSRCDIR" = "" ]; then
DEVOSRCDIR=$HOME/devo ; export DEVOSRCDIR
fi
# Check DEVOSRCDIR
if [ ! -d "$DEVOSRCDIR" ]; then
echo "$0: no directory $DEVOSRCDIR" >&2
exit 2
fi
# Default DEVOBINDIR
if [ "$DEVOBINDIR" = "" ]; then
CPU=`$DEVOSRCDIR/config.guess`
if [ $? != 0 ]; then
echo "$0: cannot run config.guess" >&2
exit 2
fi
DEVOBINDIR=$HOME/$CPU ; export DEVOBINDIR
fi
# Check DEVOBINDIR
if [ ! -d "$DEVOBINDIR" ]; then
echo "$0: no directory $DEVOBINDIR" >&2
exit 2
fi
# Specialize DEVOSRCDIR
if [ -d "$DEVOSRCDIR/$devoname" ]; then
DEVOSRCDIR=$DEVOSRCDIR/$devoname
else
echo "$0: Cannot find source directory." >&2
exit 2
fi
# Default LOGDIR
if [ "$LOGDIR" = "" ]; then
LOGDIR=$HOME/logs ; export LOGDIR
fi
# Check LOGDIR
if [ ! -d "$LOGDIR" ]; then
echo "$0: no directory $LOGDIR" >&2
exit 2
fi
# Specialize DEVOBINDIR
if [ -d "$DEVOBINDIR/$devoname" ]; then
DEVOBINDIR=$DEVOBINDIR/$devoname
else
echo "$0: Cannot find binary directory." >&2
exit 2
fi
# Binary directory
cd $DEVOBINDIR || exit 2
TMPDIR=${TMPDIR-/tmp}
tmp=$TMPDIR/$tool-testing.$$a
tmp1=$TMPDIR/$tool-testing.$$b
tmp2=$TMPDIR/$tool-testing.$$c
now_s=$TMPDIR/$tool-testing.$$d
before_s=$TMPDIR/$tool-testing.$$e
if [ "$keepoutput" = yes ]; then
rm -f test-$tool.log
make RUNTESTFLAGS="-v -v" $checktarget >test-$tool.log 2>&1
else
make RUNTESTFLAGS="-v -v" $checktarget >/dev/null 2>&1
fi
# Check for DEJAGNU errors that prevented any output at all.
if [ ! -f $testdir/$tool.sum ]; then
echo "Tests didn't run, probably because of a framework error."
if [ "$keepoutput" = yes ]; then
echo
tail -20 test-$tool.log
else
echo "Unable to determine why. Rerun with -keepoutput."
fi
exit 2
fi
# Canonicalize XFAIL and XPASS so the rest of the script can ignore them.
if [ "$expectedpass" = yes ]; then
sed 's/^XFAIL/PASS(XFAIL)/; s/^XPASS/FAIL(XPASS)/' <$testdir/$tool.sum >$testdir/$tool.1.sum || exit 2
else
sed 's/^XFAIL/FAIL(XFAIL)/; s/^XPASS/PASS(XPASS)/' <$testdir/$tool.sum >$testdir/$tool.1.sum || exit 2
fi
mv $testdir/$tool.1.sum $testdir/$tool.sum
patterns="$LOGDIR/$tool-??????.sum $LOGDIR/$tool-??????.sum.gz $LOGDIR/$tool-??????????.sum $LOGDIR/$tool-??????????.sum.gz"
before=`ls -1t $patterns 2>/dev/null | sed 1q`
todayname=`date '+%y%m%d'`
if [ "$update" = no ]; then
now=$testdir/$tool.sum
else
mv -f $testdir/$tool.sum $LOGDIR/$tool-$todayname.sum || exit 2
mv -f $testdir/$tool.log $LOGDIR/$tool-$todayname.log || exit 2
# Say where the logs are stored so they appear in email messages.
echo
echo "Log files: $LOGDIR/$tool-$todayname.*"
echo
now="$LOGDIR/$tool-$todayname.sum";
fi
trap "rm -f $tmp $tmp1 $tmp2 $now_s $before_s" 0 1 2 3 5 9 13 15
case $before in
"") before="cat /dev/null" ;;
*.gz) before="gunzip -c $before" ;;
*) before="cat $before" ;;
esac
# First, the test summary.
egrep '^# of |===.*Summary.*===' "$now" || echo "(No test summary?)"
echo
# Pick out the PASS/FAIL/Ufoo messages.
# We grep for them again later but that's for robustness' sake.
grep '^[PFU][A-Z()]*:' "$now" | sort -t ':' +1 > "$now_s"
$before | grep '^[PFU][A-Z()]*:' | sort -t ':' +1 > "$before_s"
grep '^FAIL:' "$now_s" | sed 's/^[^:]*:[ ]*//' >$tmp1
grep '^PASS' "$before_s" | sed 's/^[^:]*:[ ]*//' | comm -12 $tmp1 - >$tmp2
grep -s . $tmp2 >/dev/null
if [ $? = 0 ]; then
echo "Tests that now unexpectedly fail, but worked before:"
echo
cat $tmp2
showchangelog=1
echo
fi
grep '^FAIL:' "$now_s" | sed 's/^[^:]*:[ ]*//' >$tmp1
grep '^[PFU][A-Z()]*:' "$before_s" | sed 's/^[^:]*:[ ]*//' | comm -23 $tmp1 - >$tmp2
grep -s . $tmp2 >/dev/null
if [ $? = 0 ]; then
echo "New tests that unexpectedly FAIL:"
echo
cat $tmp2
echo
fi
grep '^FAIL:' "$now_s" | sed 's/^[^:]*:[ ]*//' >$tmp1
grep '^FAIL' "$before_s" | sed 's/^[^:]*:[ ]*//' | comm -12 $tmp1 - >$tmp2
grep -s . $tmp2 >/dev/null
if [ $? = 0 ]; then
echo "Tests that still don't work:"
echo
cat $tmp2
echo
fi
grep '^PASS' "$now_s" | sed 's/^[^:]*:[ ]*//' >$tmp1
grep '^FAIL' "$before_s" | sed 's/^[^:]*:[ ]*//' | comm -12 $tmp1 - >$tmp2
grep -s . $tmp2 >/dev/null
if [ $? = 0 ]; then
echo "Tests that now work, but didn't before:"
echo
cat $tmp2
echo
fi
grep '^PASS' "$now_s" | sed 's/^[^:]*:[ ]*//' >$tmp1
grep '^[PFU][A-Z()]*:' "$before_s" | sed 's/^[^:]*:[ ]*//' | comm -23 $tmp1 - >$tmp2
grep -s . $tmp2 >/dev/null
if [ $? = 0 ]; then
echo "New tests that PASS:"
echo
cat $tmp2
echo
fi
grep '^[PFU][A-Z()]*:' "$now_s" | sed 's/^[^:]*:[ ]*//' >$tmp1
grep '^PASS' "$before_s" | sed 's/^[^:]*:[ ]*//' | comm -13 $tmp1 - >$tmp2
grep -s . $tmp2 >/dev/null
if [ $? = 0 ]; then
echo "Old tests that passed, that have disappeared: (Eeek!)"
echo
cat $tmp2
echo
fi
grep '^[PFU][A-Z()]*:' "$now_s" | sed 's/^[^:]*:[ ]*//' >$tmp1
grep '^FAIL' "$before_s" | sed 's/^[^:]*:[ ]*//' | comm -13 $tmp1 - >$tmp2
grep -s . $tmp2 >/dev/null
if [ $? = 0 ]; then
echo "Old tests that failed, that have disappeared: (Eeek!)"
echo
cat $tmp2
echo
fi
egrep '^(ERROR|WARNING):' "$now" >$tmp1
if grep -s . $tmp1 > /dev/null; then
echo "Errors and warnings:"
echo
cat $tmp1
echo
fi
if [ "$tool" = g++ ]; then
if [ -f $DEVOBINDIR/libio/run-make-check ]; then
cd $DEVOBINDIR/libio
make check >$TMPDIR/clgpp$$ 2>&1
if [ $? != 0 ]; then
echo
echo "libio fails to make check:"
tail -20 $TMPDIR/clgpp$$
fi
fi
if [ -f $DEVOBINDIR/libstdc++/run-make-check ]; then
cd $DEVOBINDIR/libstdc++
make check >$TMPDIR/clgpp$$ 2>&1
if [ $? != 0 ]; then
echo
echo "libstdc++ fails to make check:"
tail -20 $TMPDIR/clgpp$$
fi
fi
if [ -f $DEVOBINDIR/libg++/run-make-check ]; then
cd $DEVOBINDIR/libg++
make check >$TMPDIR/clgpp$$ 2>&1
if [ $? != 0 ]; then
echo
echo "libg++ fails to make check:"
tail -20 $TMPDIR/clgpp$$
fi
fi
rm -f $TMPDIR/clgpp$$
cd $DEVOBINDIR
fi
if [ "$devoname" != "" ]; then
if [ "$showchangelog" = 1 ]; then
echo "Here is what's new in the ChangeLog:"
echo
diff -c $LOGDIR/$devoname.ChangeLog $DEVOSRCDIR/ChangeLog
echo
if [ "$tool" = g++ ]; then
echo
echo "Here is what's new in the ChangeLog.egcs:"
echo
diff -c $LOGDIR/gcc.ChangeLog.egcs $DEVOSRCDIR/ChangeLog.egcs
echo
echo "Here is what's new in the cp/ChangeLog:"
echo
diff -c $LOGDIR/g++.ChangeLog $DEVOSRCDIR/cp/ChangeLog
fi
echo
fi
if [ "$update" != no ]; then
# save the old ChangeLog as a reference for next time
rm -f $LOGDIR/$devoname.ChangeLog.BAK
mv $LOGDIR/$devoname.ChangeLog $LOGDIR/$devoname.ChangeLog.BAK 2>/dev/null
$CP $DEVOSRCDIR/ChangeLog $LOGDIR/$devoname.ChangeLog
if [ "$tool" = g++ ]; then
rm -f $LOGDIR/gcc.ChangeLog.egcs.BAK
mv $LOGDIR/gcc.ChangeLog.egcs $LOGDIR/gcc.ChangeLog.egcs.BAK 2>/dev/null
$CP $DEVOSRCDIR/ChangeLog.egcs $LOGDIR/gcc.ChangeLog.egcs
rm -f $LOGDIR/g++.ChangeLog.BAK
mv $LOGDIR/g++.ChangeLog $LOGDIR/g++.ChangeLog.BAK 2>/dev/null
$CP $DEVOSRCDIR/cp/ChangeLog $LOGDIR/g++.ChangeLog
fi
fi
fi
$before | diff - $now | grep -s . >/dev/null
if [ $? = 0 ]; then
echo "Details:"
echo
$before | diff - $now
echo
fi
|