-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrun_all.sh
More file actions
executable file
·604 lines (516 loc) · 15.2 KB
/
run_all.sh
File metadata and controls
executable file
·604 lines (516 loc) · 15.2 KB
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
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
#!/bin/sh
# Run ACATS with the GNU Ada compiler
# The following functions are to be customized if you run in cross
# environment or want to change compilation flags. Note that for
# tests requiring checks not turned on by default, this script
# automatically adds the needed flags to pass (ie: -gnato or -gnatE).
# The default options are -gnatws -g -O2. You can pass additional
# options at runtime by using RUNTESTFLAGS:
#
# make check-acats RUNTESTFLAGS="--target_board=unix/-O3/-gnatN"
#
# compiles with -gnatws -gnatN -g -O2 -O3 (as well as other
# test-specific options).
#
# N.B. if you wish to pass any GNAT-specific options (e.g. -gnat*) you
# must only run this suite (make check-acats), because -gnat* will
# fail with most other tools ("unrecognized debug output level
# 'nat*").
# N.B. do not use RUNTESTFLAGS with -j<n>: it doesn't get passed to
# sub-makes (at 2018-02-10).
#
# The default options are -g -O2 -gnatws.
gccflags="-g -O2"
gnatflags="-gnatws"
flags=`echo $RUNTESTFLAGS |
fmt -1 |
grep target_board=unix |
sed -E -e "s/^.*=unix//" -e "s;/; ;g"`
for f in $flags; do
case $f in
-gnat*)
gnatflags="$gnatflags $f";;
*)
gccflags="$gccflags $f";;
esac;
done;
# End of customization section.
# Perform arithmetic evaluation on the ARGs, and store the result in the
# global $as_val. Take advantage of shells that can avoid forks. The arguments
# must be portable across $(()) and expr.
if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
eval 'as_fn_arith ()
{
as_val=$(( $* ))
}'
else
as_fn_arith ()
{
as_val=`expr "$@" || test $? -eq 1`
}
fi # as_fn_arith
display_noeol () {
printf "$@"
printf "$@" >> $dir/acats.sum
printf "$@" >> $dir/acats.log
}
display () {
echo "$@"
echo "$@" >> $dir/acats.sum
echo "$@" >> $dir/acats.log
}
log () {
echo "$@" >> $dir/acats.sum
echo "$@" >> $dir/acats.log
}
dir=`${PWDCMD-pwd}`
if [ "$dir" = "$testdir" ]; then
echo "error: srcdir must be different than objdir, exiting."
exit 1
fi
if [ "$BASE" ]; then
GCC="$BASE/xgcc -B$BASE/"
else
GCC="${GCC-`which gcc`}"
fi
target_gnatchop () {
if [ "$BASE" ]; then
$BASE/gnatchop --GCC="$BASE/xgcc" $*
else
host_gnatchop $*
fi
return $?
}
target_gnatmake () {
if [ "$BASE" ]; then
echo $BASE/gnatmake --GNATBIND=$BASE/gnatbind --GNATLINK=$BASE/gnatlink --GCC="$GCC" $gnatflags $gccflags $* -largs $EXTERNAL_OBJECTS --GCC="$GCC"
$BASE/gnatmake --GNATBIND=$BASE/gnatbind --GNATLINK=$BASE/gnatlink --GCC="$GCC" $gnatflags $gccflags $* -largs $EXTERNAL_OBJECTS --GCC="$GCC"
else
echo gnatmake $gnatflags $gccflags $* -largs $EXTERNAL_OBJECTS
host_gnatmake $gnatflags $gccflags $* -largs $EXTERNAL_OBJECTS
fi
}
target_gcc () {
$GCC $gccflags $*
}
target_run () {
eval $EXPECT -f $testdir/run_test.exp $*
}
clean_dir () {
rm -f "$binmain" *.o *.ali > /dev/null 2>&1
}
find_main () {
# Must handle the cases that aren't correctly identified (ACATS 4.1)
# $1 is the test
case ${1} in
c3a1003)
main=c3a10032
;;
c3a1004)
main=c3a10042
;;
ca11023)
main=ca110232
;;
*)
ls ${1}?.adb > ${1}.lst 2> /dev/null
ls ${1}*m.adb >> ${1}.lst 2> /dev/null
ls ${1}.adb >> ${1}.lst 2> /dev/null
main=`tail -1 ${1}.lst`
;;
esac
}
handle_pass () {
# check that a pass for test $1 wasn't supposed to fail
grep ${1} $testdir/xfail.lst >/dev/null 2>&1
inlist=$?
echo ${1} | egrep '^[bl]' >/dev/null 2>&1
b_or_l=$?
if [ $inlist -ne 0 -a $b_or_l -ne 0 ]; then
# OK to have passed
log "PASS: $1"
as_fn_arith $glob_countok + 1
glob_countok=$as_val
else
# should have failed
log "XPASS: $1"
as_fn_arith $glob_countxp + 1
glob_countxp=$as_val
fi
}
handle_fail () {
# check that a fail for test $1 wasn't supposed to pass
grep ${1} $testdir/xfail.lst >/dev/null 2>&1
inlist=$?
echo ${1} | egrep '^[bl]' >/dev/null 2>&1
b_or_l=$?
if [ $inlist -eq 0 -o $b_or_l -eq 0 ]; then
# OK to have failed
log "XFAIL: $1"
as_fn_arith $glob_countxf + 1
glob_countxf=$as_val
else
# should have passed
display "FAIL: $1"
as_fn_arith $glob_countf + 1
glob_countf=$as_val
failed="${failed}${tst} "
fi
}
run_one_test () {
tst=$1
grep $tst $testdir/norun.lst > /dev/null 2>&1
if [ $? -eq 0 ]; then
log "UNSUPPORTED: $tst"
as_fn_arith $glob_countu + 1
glob_countu=$as_val
clean_dir
return
fi
extraflags="-gnat2012"
grep $tst $testdir/overflow.lst > /dev/null 2>&1
if [ $? -eq 0 ]; then
extraflags="$extraflags -gnato"
fi
grep $tst $testdir/elabd.lst > /dev/null 2>&1
if [ $? -eq 0 ]; then
extraflags="$extraflags -gnatE"
fi
grep $tst $testdir/floatstore.lst > /dev/null 2>&1
if [ $? -eq 0 ]; then
extraflags="$extraflags -ffloat-store"
fi
grep $tst $testdir/stackcheck.lst > /dev/null 2>&1
if [ $? -eq 0 ]; then
extraflags="$extraflags -fstack-check"
fi
grep $tst $testdir/listing.lst > /dev/null 2>&1
if [ $? -eq 0 ]; then
extraflags="$extraflags -gnatl"
fi
test=$dir/tests/$chapter/$tst
rm -rf $test
mkdir $test && cd $test >> $dir/acats.log 2>&1
if [ $? -ne 0 ]; then
handle_fail $tst
clean_dir
return
fi
target_gnatchop -c `ls ${test}*.a ${test}*.ada ${test}*.au ${test}*.adt ${test}*.am ${test}*.dep 2> /dev/null` > chop.log 2>&1
chopped=$?
cat chop.log >>$dir/acats.log
# If gnatchop failed because the same unit appears more than once in
# the sources, handle as UNSUPPORTED. Otherwise, let the compiler
# report any problems.
if [ $chopped -ne 0 ]; then
grep 'use -w to overwrite' chop.log > /dev/null 2>$1
if [ $? -eq 0 ]; then
log "UNSUPPORTED: $tst"
as_fn_arith $glob_countu + 1
glob_countu=$as_val
clean_dir
return
fi
fi
main=""
find_main $i
if [ -z "$main" ]; then
sync
find_main $i
fi
binmain=`echo $main | sed -e 's/\(.*\)\..*/\1/g'`
echo "BUILD $main" >> $dir/acats.log
case $tst in
cxb3004) EXTERNAL_OBJECTS="$dir_support/cxb30040.o";;
cxb3006) EXTERNAL_OBJECTS="$dir_support/cxb30060.o";;
cxb3013) EXTERNAL_OBJECTS="$dir_support/cxb30130.o $dir_support/cxb30131.o";;
cxb3017) EXTERNAL_OBJECTS="$dir_support/cxb30170.o";;
cxb3018) EXTERNAL_OBJECTS="$dir_support/cxb30180.o";;
cxb3023) EXTERNAL_OBJECTS="$dir_support/cxb30230.o";;
cxb3024) EXTERNAL_OBJECTS="$dir_support/cxb30240.o";;
*) EXTERNAL_OBJECTS="";;
esac
if [ "$main" = "" ]; then
handle_fail $tst
clean_dir
return
fi
target_gnatmake $extraflags -I$dir_support $main \
> $dir/tests/$chapter/${tst}/${tst}.log 2>&1
compilation_status=$?
cat $dir/tests/$chapter/${tst}/${tst}.log >> $dir/acats.log
if [ $compilation_status -ne 0 ]; then
grep 'not supported in this configuration' \
$dir/tests/$chapter/${tst}/${tst}.log > /dev/null 2>&1
if [ $? -eq 0 ]; then
log "UNSUPPORTED: $tst"
as_fn_arith $glob_countu + 1
glob_countu=$as_val
else
handle_fail $tst
fi
clean_dir
return
fi
echo "RUN $binmain" >> $dir/acats.log
cd $dir/run
if [ ! -x $dir/tests/$chapter/$tst/$binmain ]; then
sync
fi
target_run $dir/tests/$chapter/$tst/$binmain > $dir/tests/$chapter/$tst/${tst}.log 2>&1
cd $dir/tests/$chapter/$tst
cat ${tst}.log >> $dir/acats.log
# check for a status report from execution
status=`egrep -e '(==== |\+\+\+\+ |\!\!\!\! )' ${tst}.log`
if [ $? -ne 0 ]; then
grep 'tasking not implemented' ${tst}.log > /dev/null 2>&1
if [ $? -ne 0 ]; then
handle_fail $tst
else
log "UNSUPPORTED: $tst"
as_fn_arith $glob_countu + 1
glob_countu=$as_val
fi
else
case `echo $status | cut -c1-4` in
"====")
handle_pass $tst;;
"++++")
log "UNSUPPORTED: $tst"
as_fn_arith $glob_countna + 1
glob_countna=$as_val;;
"!!!!")
log "UNRESOLVED: $tst"
as_fn_arith $glob_counti + 1
glob_counti=$as_val;;
*)
log "ERROR: $tst"
as_fn_arith $glob_counti + 1
glob_counti=$as_val;;
esac
fi
clean_dir
}
EXTERNAL_OBJECTS=""
# Global variable to communicate external objects to link with.
rm -f $dir/acats.sum $dir/acats.log
display "Test Run By $USER on `date`"
display " === acats configuration ==="
target=`$GCC -dumpmachine`
display target gcc is $GCC
display `$GCC -v 2>&1`
display host=`gcc -dumpmachine`
display target=$target
display `type gnatmake`
gnatls -v >> $dir/acats.log
display ""
if [ -n "$GCC_RUNTEST_PARALLELIZE_DIR" ]; then
dir_support=$dir/../acats/support
rm -rf $dir/run
mv $dir/tests $dir/tests.$$ 2> /dev/null
rm -rf $dir/tests.$$ &
mkdir -p $dir/run
cp -pr $dir/../acats/tests $dir/
else
dir_support=$dir/support
# Only build support if needed
if [ ! -d $dir_support ] || [ $# -eq 0 ] || [ $1 = "NONE" ]; then
display " === acats support ==="
display_noeol "Generating support files..."
rm -rf $dir/support
mkdir -p $dir/support
cd $dir/support
cp $testdir/support/*.ada $testdir/support/*.a $testdir/support/*.tst $dir/support
# Find out the size in bit of an address on the target
target_gnatmake $testdir/support/impbit.adb >> $dir/acats.log 2>&1
if [ $? -ne 0 ]; then
display "**** Failed to compile impbit"
exit 1
fi
target_run $dir/support/impbit > $dir/support/impbit.out 2>&1
target_bit=`cat $dir/support/impbit.out`
echo target_bit="$target_bit" >> $dir/acats.log
case "$target_bit" in
*32*)
target_max_int="9223372036854775807"
target_min_int="-9223372036854775808"
;;
*64*)
target_max_int="170141183460469231731687303715884105727"
target_min_int="-170141183460469231731687303715884105728"
;;
*)
display "**** Unsupported bits per word"
exit 1
esac
echo target_max_insn="$target_max_int" >> $dir/acats.log
echo target_min_insn="$target_min_int" >> $dir/acats.log
# Find out a suitable asm statement
# Adapted from configure.ac gcc_cv_as_dwarf2_debug_line
case "$target" in
ia64*-*-* | s390*-*-*)
target_insn="nop 0"
;;
mmix-*-*)
target_insn="swym 0"
;;
*)
target_insn="nop"
;;
esac
echo target_insn="$target_insn" >> $dir/acats.log
sed -e "s,ACATS4GNATDIR,$dir,g" \
< $testdir/support/impdef.a > $dir/support/impdef.a
sed -e "s,ACATS4GNATDIR,$dir,g" \
< $testdir/support/impdefc.a > $dir/support/impdefc.a
sed -e "s,ACATS4GNATDIR,$dir,g" \
-e "s,ACATS4GNATBIT,$target_bit,g" \
-e "s,ACATS4GNATINSN,$target_insn,g" \
-e "s,ACATS4GNATMAXINT,$target_max_int,g" \
-e "s,ACATS4GNATMININT,$target_min_int,g" \
< $testdir/support/macro.dfs > $dir/support/MACRO.DFS
sed -e "s,ACATS4GNATDIR,$dir,g" \
< $testdir/support/tsttests.dat > $dir/support/TSTTESTS.DAT
cp $testdir/tests/cd/*.c $dir/support
cp $testdir/tests/cxb/*.c $dir/support
rm -rf $dir/run
mv $dir/tests $dir/tests.$$ 2> /dev/null
rm -rf $dir/tests.$$ &
mkdir -p $dir/run
cp -pr $testdir/tests $dir/
for i in $dir/support/*.ada $dir/support/*.a; do
host_gnatchop $i >> $dir/acats.log 2>&1
done
# These tools are used to preprocess some ACATS sources.
# They need to be compiled native on the host.
host_gnatmake -q -gnatws macrosub.adb
if [ $? -ne 0 ]; then
display "**** Failed to compile macrosub"
exit 1
fi
./macrosub >> $dir/acats.log 2>&1
rm -f $dir/support/macrosub
rm -f $dir/support/*.ali
rm -f $dir/support/*.o
display " done."
# From here, all compilations will be made by the target compiler
display_noeol "Compiling support files..."
# This program is used to support Annex C tests via impdefc.a.
target_gnatmake $testdir/support/send_sigint_to_parent.adb \
>> $dir/acats.log 2>&1
if [ $? -ne 0 ]; then
display "**** Failed to compile send_sigint_to_parent"
exit 1
fi
target_gcc -c *.c >> $dir/acats.log 2>&1
if [ $? -ne 0 ]; then
display "**** Failed to compile C code"
exit 1
fi
target_gnatchop *.adt >> $dir/acats.log 2>&1
target_gnatmake -c -gnato -gnatE *.adb >> $dir/acats.log 2>&1
display " done."
display ""
fi
fi
display " === acats tests ==="
if [ $# -eq 0 ]; then
# Run all the tests.
chapters=`cd $dir/tests; echo *`
else
chapters=$*
fi
# number of passed tests
glob_countok=0
# number of tests that should be inspected
glob_counti=0
# number of unsupported tests, as reported by the compiler
glob_countu=0
# number of not-applicable tests, as determined by running the test.
glob_countna=0
# number of failures
glob_countf=0
# number of expected failures
glob_countxf=0
# number of unexpected passes
glob_countxp=0
# These for possible parallel execution, see below
par_count=0
par_countm=0
par_last=
for chapter in $chapters; do
# Used to generate support once and finish after that.
[ "$chapter" = "NONE" ] && continue
display Running chapter $chapter ...
if [ ! -d $dir/tests/$chapter ]; then
display "*** CHAPTER $chapter does not exist, skipping."
display ""
continue
fi
cd $dir/tests/$chapter
ls *.a *.ada *.adt *.am *.au *.dep 2> /dev/null | \
sed -e 's/\(.*\)\..*/\1/g' | \
cut -c1-7 | sort | uniq \
> $dir/tests/$chapter/${chapter}.lst
for i in `cat $dir/tests/$chapter/${chapter}.lst`; do
# If running multiple run_all.sh jobs in parallel, decide
# if we should run this test in the current instance.
if [ -n "$GCC_RUNTEST_PARALLELIZE_DIR" ]; then
case "$i" in
# Ugh, some tests have inter-test dependencies, those
# tests have to be scheduled on the same parallel instance
# as previous test.
ce2108f | ce2108h | ce3112d) ;;
# All others can be hopefully scheduled freely.
*)
as_fn_arith $par_countm + 1
par_countm=$as_val
[ $par_countm -eq 10 ] && par_countm=0
if [ $par_countm -eq 1 ]; then
as_fn_arith $par_count + 1
par_count=$as_val
if mkdir $GCC_RUNTEST_PARALLELIZE_DIR/$par_count 2>/dev/null; then
par_last=1
else
par_last=
fi
fi;;
esac
if [ -z "$par_last" ]; then
continue
fi
fi
run_one_test $i
done
done
display " === acats Summary ==="
# text must be as expected by contrib/dg-extract-results.py (including
# tabs)
display "# of expected passes $glob_countok"
display "# of unexpected failures $glob_countf"
if [ $glob_countxf -ne 0 ]; then
display "# of expected failures $glob_countxf"
fi
if [ $glob_countxp -ne 0 ]; then
display "# of unexpected successes $glob_countxp"
fi
# preparing output for standard run; must only use names supported
# by contrib/dg-extract-results.py
if [ $glob_counti -ne 0 ]; then
display "# of unresolved testcases $glob_counti"
fi
as_fn_arith $glob_countu + $glob_countna
unsupported=$as_val
if [ $unsupported -ne 0 ]; then
display "# of unsupported tests $unsupported"
fi
if [ $glob_countf -ne 0 ]; then
display "*** FAILURES: $failed"
fi
display "$0 completed at `date`"
exit 0
# for Emacs
# Local Variables:
# sh-indentation: 2
# sh-basic-offset: 2
# End: