2 # Run ACATS with the GNU Ada compiler
4 # The following functions are to be customized if you run in cross
5 # environment or want to change compilation flags. Note that for
6 # tests requiring checks not turned on by default, this script
7 # automatically adds the needed flags to pass (ie: -gnato or -gnatE).
9 # gccflags="-O3 -funroll-loops"
15 # End of customization section.
17 # Perform arithmetic evaluation on the ARGs, and store the result in the
18 # global $as_val. Take advantage of shells that can avoid forks. The arguments
19 # must be portable across $(()) and expr.
20 if (eval "test \$(( 1 + 1 )) = 2") 2>/dev
/null
; then :
28 as_val
=`expr "$@" || test $? -eq 1`
34 printf "$@" >> $dir/acats.
sum
35 printf "$@" >> $dir/acats.log
40 echo "$@" >> $dir/acats.
sum
41 echo "$@" >> $dir/acats.log
45 echo "$@" >> $dir/acats.
sum
46 echo "$@" >> $dir/acats.log
51 if [ "$dir" = "$testdir" ]; then
52 echo "error: srcdir must be different than objdir, exiting."
56 GCC
="$BASE/xgcc -B$BASE/"
59 $BASE/gnatchop
--GCC="$BASE/xgcc" $
*
63 echo $BASE/gnatmake
--GNATBIND=$BASE/gnatbind
--GNATLINK=$BASE/gnatlink
--GCC="$GCC" $gnatflags $gccflags $
* -largs $EXTERNAL_OBJECTS --GCC="$GCC"
64 $BASE/gnatmake
--GNATBIND=$BASE/gnatbind
--GNATLINK=$BASE/gnatlink
--GCC="$GCC" $gnatflags $gccflags $
* -largs $EXTERNAL_OBJECTS --GCC="$GCC"
72 eval $EXPECT -f $testdir/run_test.exp $
*
76 rm -f "$binmain" *.o
*.ali
> /dev
/null
2>&1
80 ls ${i}?.adb
> ${i}.lst
2> /dev
/null
81 ls ${i}*m.adb
>> ${i}.lst
2> /dev
/null
82 ls ${i}.adb
>> ${i}.lst
2> /dev
/null
83 main
=`tail -1 ${i}.lst`
87 # Global variable to communicate external objects to link with.
89 rm -f $dir/acats.
sum $dir/acats.log
91 display
"Test Run By $USER on `date`"
93 display
" === acats configuration ==="
95 target
=`$GCC -dumpmachine`
97 display target gcc is
$GCC
98 display
`$GCC -v 2>&1`
99 display
host=`gcc -dumpmachine`
100 display target
=$target
101 display
`type gnatmake`
102 gnatls
-v >> $dir/acats.log
105 if [ -n "$GCC_RUNTEST_PARALLELIZE_DIR" ]; then
106 dir_support
=$dir/..
/acats
/support
109 mv $dir/tests
$dir/tests.$$
2> /dev
/null
110 rm -rf $dir/tests.$$
&
113 cp -pr $dir/..
/acats
/tests
$dir/
115 dir_support
=$dir/support
117 display
" === acats support ==="
118 display_noeol
"Generating support files..."
121 mkdir
-p $dir/support
124 cp $testdir/support
/*.ada
$testdir/support
/*.a
$testdir/support
/*.tst
$dir/support
126 # Find out the size in bit of an address on the target
127 target_gnatmake
$testdir/support
/impbit.adb
>> $dir/acats.log
2>&1
128 if [ $?
-ne 0 ]; then
129 display
"**** Failed to compile impbit"
132 target_run
$dir/support
/impbit
> $dir/support
/impbit.out
2>&1
133 target_bit
=`cat $dir/support/impbit.out`
134 echo target_bit
="$target_bit" >> $dir/acats.log
136 case "$target_bit" in
138 target_max_int
="9223372036854775807"
139 target_min_int
="-9223372036854775808"
142 target_max_int
="170141183460469231731687303715884105727"
143 target_min_int
="-170141183460469231731687303715884105728"
146 display
"**** Unsupported bits per word"
150 echo target_max_insn
="$target_max_int" >> $dir/acats.log
151 echo target_min_insn
="$target_min_int" >> $dir/acats.log
153 # Find out a suitable asm statement
154 # Adapted from configure.ac gcc_cv_as_dwarf2_debug_line
156 ia64
*-*-* | s390
*-*-*)
166 echo target_insn
="$target_insn" >> $dir/acats.log
168 sed -e "s,ACATS4GNATDIR,$dir,g" \
169 < $testdir/support
/impdef.a
> $dir/support
/impdef.a
170 sed -e "s,ACATS4GNATDIR,$dir,g" \
171 -e "s,ACATS4GNATBIT,$target_bit,g" \
172 -e "s,ACATS4GNATINSN,$target_insn,g" \
173 -e "s,ACATS4GNATMAXINT,$target_max_int,g" \
174 -e "s,ACATS4GNATMININT,$target_min_int,g" \
175 < $testdir/support
/macro.dfs
> $dir/support
/MACRO.DFS
176 sed -e "s,ACATS4GNATDIR,$dir,g" \
177 < $testdir/support
/tsttests.dat
> $dir/support
/TSTTESTS.DAT
179 cp $testdir/tests
/cd
/*.c
$dir/support
180 cp $testdir/tests
/cxb
/*.c
$dir/support
181 grep -v '^#' $testdir/norun.lst |
sort > $dir/support
/norun.lst
184 mv $dir/tests
$dir/tests.$$
2> /dev
/null
185 rm -rf $dir/tests.$$
&
188 cp -pr $testdir/tests
$dir/
190 for i
in $dir/support
/*.ada
$dir/support
/*.a
; do
191 host_gnatchop
$i >> $dir/acats.log
2>&1
194 # These tools are used to preprocess some ACATS sources
195 # they need to be compiled native on the host.
197 host_gnatmake
-q -gnatws macrosub.adb
198 if [ $?
-ne 0 ]; then
199 display
"**** Failed to compile macrosub"
202 .
/macrosub
> macrosub.out
2>&1
205 host_gnatmake
-q -gnatws widechr.adb
206 if [ $?
-ne 0 ]; then
207 display
"**** Failed to compile widechr"
210 .
/widechr
> widechr.out
2>&1
212 rm -f $dir/support
/macrosub
213 rm -f $dir/support
/widechr
214 rm -f $dir/support
/*.ali
215 rm -f $dir/support
/*.o
219 # From here, all compilations will be made by the target compiler
221 display_noeol
"Compiling support files..."
224 if [ $?
-ne 0 ]; then
225 display
"**** Failed to compile C code"
229 target_gnatchop
*.adt
>> $dir/acats.log
2>&1
231 target_gnatmake
-c -gnato -gnatE *.ads
>> $dir/acats.log
2>&1
232 target_gnatmake
-c -gnato -gnatE *.adb
>> $dir/acats.log
2>&1
239 display
" === acats tests ==="
241 if [ $# -eq 0 ]; then
242 chapters
=`cd $dir/tests; echo [a-z]*`
254 for chapter
in $chapters; do
255 # Used to generate support once and finish after that.
256 [ "$chapter" = "NONE" ] && continue
258 display Running chapter
$chapter ...
260 if [ ! -d $dir/tests
/$chapter ]; then
261 display
"*** CHAPTER $chapter does not exist, skipping."
266 cd $dir/tests
/$chapter
267 ls *.a
*.ada
*.adt
*.am
*.dep
2> /dev
/null |
sed -e 's/\(.*\)\..*/\1/g' | \
268 cut
-c1-7 |
sort |
uniq |
comm -23 - $dir_support/norun.lst \
269 > $dir/tests
/$chapter/${chapter}.lst
270 countn
=`wc -l < $dir/tests/$chapter/${chapter}.lst`
271 as_fn_arith
$glob_countn + $countn
273 for i
in `cat $dir/tests/$chapter/${chapter}.lst`; do
275 # If running multiple run_all.sh jobs in parallel, decide
276 # if we should run this test in the current instance.
277 if [ -n "$GCC_RUNTEST_PARALLELIZE_DIR" ]; then
279 # Ugh, some tests have inter-test dependencies, those
280 # tests have to be scheduled on the same parallel instance
282 ce2108f | ce2108h | ce3112d
) ;;
283 # All others can be hopefully scheduled freely.
285 as_fn_arith
$par_countm + 1
287 [ $par_countm -eq 10 ] && par_countm
=0
288 if [ $par_countm -eq 1 ]; then
289 as_fn_arith
$par_count + 1
291 if mkdir
$GCC_RUNTEST_PARALLELIZE_DIR/$par_count 2>/dev
/null
; then
298 if [ -z "$par_last" ]; then
299 as_fn_arith
$glob_countn - 1
306 grep $i $testdir/overflow.lst
> /dev
/null
2>&1
307 if [ $?
-eq 0 ]; then
308 extraflags
="$extraflags -gnato"
310 grep $i $testdir/elabd.lst
> /dev
/null
2>&1
311 if [ $?
-eq 0 ]; then
312 extraflags
="$extraflags -gnatE"
314 grep $i $testdir/floatstore.lst
> /dev
/null
2>&1
315 if [ $?
-eq 0 ]; then
316 extraflags
="$extraflags -ffloat-store"
318 grep $i $testdir/stackcheck.lst
> /dev
/null
2>&1
319 if [ $?
-eq 0 ]; then
320 extraflags
="$extraflags -fstack-check"
322 test=$dir/tests
/$chapter/$i
323 mkdir
$test && cd $test >> $dir/acats.log
2>&1
325 if [ $?
-ne 0 ]; then
327 failed
="${failed}${i} "
332 target_gnatchop
-c -w `ls ${test}*.a ${test}*.ada ${test}*.adt ${test}*.am ${test}*.dep 2> /dev/null` >> $dir/acats.log
2>&1
335 if [ -z "$main" ]; then
339 binmain
=`echo $main | sed -e 's/\(.*\)\..*/\1/g'`
340 echo "BUILD $main" >> $dir/acats.log
343 cxb30
*) EXTERNAL_OBJECTS
="$dir_support/cxb30040.o $dir_support/cxb30060.o $dir_support/cxb30130.o $dir_support/cxb30131.o";;
344 ca1020e
) rm -f ca1020e_func1.adb ca1020e_func2.adb ca1020e_proc1.adb ca1020e_proc2.adb
> /dev
/null
2>&1;;
345 ca14028
) rm -f ca14028_func2.ads ca14028_func3.ads ca14028_proc1.ads ca14028_proc3.ads
> /dev
/null
2>&1;;
347 if [ "$main" = "" ]; then
349 failed
="${failed}${i} "
354 target_gnatmake
$extraflags -I$dir_support $main >> $dir/acats.log
2>&1
355 if [ $?
-ne 0 ]; then
357 failed
="${failed}${i} "
362 echo "RUN $binmain" >> $dir/acats.log
364 if [ ! -x $dir/tests
/$chapter/$i/$binmain ]; then
367 target_run
$dir/tests
/$chapter/$i/$binmain > $dir/tests
/$chapter/$i/${i}.log
2>&1
368 cd $dir/tests
/$chapter/$i
369 cat ${i}.log
>> $dir/acats.log
370 egrep -e '(==== |\+\+\+\+ |\!\!\!\! )' ${i}.log
> /dev
/null
2>&1
371 if [ $?
-ne 0 ]; then
372 grep 'tasking not implemented' ${i}.log
> /dev
/null
2>&1
374 if [ $?
-ne 0 ]; then
376 failed
="${failed}${i} "
378 log
"UNSUPPORTED: $i"
379 as_fn_arith
$glob_countn - 1
381 as_fn_arith
$glob_countu + 1
386 as_fn_arith
$glob_countok + 1
393 display
" === acats Summary ==="
394 display
"# of expected passes $glob_countok"
395 display
"# of unexpected failures `expr $glob_countn - $glob_countok`"
397 if [ $glob_countu -ne 0 ]; then
398 display
"# of unsupported tests $glob_countu"
401 if [ $glob_countok -ne $glob_countn ]; then
402 display
"*** FAILURES: $failed"
405 display
"$0 completed at `date`"