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 -fomit-frame-pointer -funroll-all-loops -finline-functions"
16 eval $EXPECT -f $testdir/run_test.exp $
*
19 # End of customization section.
21 # Perform arithmetic evaluation on the ARGs, and store the result in the
22 # global $as_val. Take advantage of shells that can avoid forks. The arguments
23 # must be portable across $(()) and expr.
24 if (eval "test \$(( 1 + 1 )) = 2") 2>/dev
/null
; then :
32 as_val
=`expr "$@" || test $? -eq 1`
38 printf "$@" >> $dir/acats.
sum
39 printf "$@" >> $dir/acats.log
44 echo "$@" >> $dir/acats.
sum
45 echo "$@" >> $dir/acats.log
49 echo "$@" >> $dir/acats.
sum
50 echo "$@" >> $dir/acats.log
55 if [ "$testdir" = "" ]; then
56 echo You must use
make check or
make check-ada
60 if [ "$dir" = "$testdir" ]; then
61 echo "error: srcdir must be different than objdir, exiting."
66 gnatchop
--GCC="$GCC_DRIVER" $
*
70 echo gnatmake
--GCC=\"$GCC\" $gnatflags $gccflags $
* -largs $EXTERNAL_OBJECTS --GCC=\"$GCC\"
71 gnatmake
--GCC="$GCC" $gnatflags $gccflags $
* -largs $EXTERNAL_OBJECTS --GCC="$GCC"
79 rm -f "$binmain" *.o
*.ali
> /dev
/null
2>&1
83 ls ${i}?.adb
> ${i}.lst
2> /dev
/null
84 ls ${i}*m.adb
>> ${i}.lst
2> /dev
/null
85 ls ${i}.adb
>> ${i}.lst
2> /dev
/null
86 main
=`tail -1 ${i}.lst`
90 # Global variable to communicate external objects to link with.
92 rm -f $dir/acats.
sum $dir/acats.log
94 display
"Test Run By $USER on `date`"
96 display
" === acats configuration ==="
98 target
=`$GCC -dumpmachine`
100 display target gcc is
$GCC
101 display
`$GCC -v 2>&1`
102 display
host=`gcc -dumpmachine`
103 display target
=$target
104 display
`type gnatmake`
105 gnatls
-v >> $dir/acats.log
108 if [ -n "$GCC_RUNTEST_PARALLELIZE_DIR" ]; then
109 dir_support
=$dir/..
/acats
/support
112 mv $dir/tests
$dir/tests.$$
2> /dev
/null
113 rm -rf $dir/tests.$$
&
116 cp -pr $dir/..
/acats
/tests
$dir/
118 dir_support
=$dir/support
120 display
" === acats support ==="
121 display_noeol
"Generating support files..."
124 mkdir
-p $dir/support
127 cp $testdir/support
/*.ada
$testdir/support
/*.a
$testdir/support
/*.tst
$dir/support
129 # Find out the size in bit of an address on the target
130 target_gnatmake
$testdir/support
/impbit.adb
>> $dir/acats.log
2>&1
131 target_run
$dir/support
/impbit
> $dir/support
/impbit.out
2>&1
132 target_bit
=`cat $dir/support/impbit.out`
133 echo target_bit
="$target_bit" >> $dir/acats.log
135 # Find out a suitable asm statement
136 # Adapted from configure.ac gcc_cv_as_dwarf2_debug_line
138 ia64
*-*-* | s390
*-*-*)
148 echo target_insn
="$target_insn" >> $dir/acats.log
150 sed -e "s,ACATS4GNATDIR,$dir,g" \
151 < $testdir/support
/impdef.a
> $dir/support
/impdef.a
152 sed -e "s,ACATS4GNATDIR,$dir,g" \
153 -e "s,ACATS4GNATBIT,$target_bit,g" \
154 -e "s,ACATS4GNATINSN,$target_insn,g" \
155 < $testdir/support
/macro.dfs
> $dir/support
/MACRO.DFS
156 sed -e "s,ACATS4GNATDIR,$dir,g" \
157 < $testdir/support
/tsttests.dat
> $dir/support
/TSTTESTS.DAT
159 cp $testdir/tests
/cd
/*.c
$dir/support
160 cp $testdir/tests
/cxb
/*.c
$dir/support
161 grep -v '^#' $testdir/norun.lst |
sort > $dir/support
/norun.lst
164 mv $dir/tests
$dir/tests.$$
2> /dev
/null
165 rm -rf $dir/tests.$$
&
168 cp -pr $testdir/tests
$dir/
170 for i
in $dir/support
/*.ada
$dir/support
/*.a
; do
171 host_gnatchop
$i >> $dir/acats.log
2>&1
174 # These tools are used to preprocess some ACATS sources
175 # they need to be compiled native on the host.
177 host_gnatmake
-q -gnatws macrosub.adb
178 if [ $?
-ne 0 ]; then
179 display
"**** Failed to compile macrosub"
182 .
/macrosub
> macrosub.out
2>&1
185 host_gnatmake
-q -gnatws widechr.adb
186 if [ $?
-ne 0 ]; then
187 display
"**** Failed to compile widechr"
190 .
/widechr
> widechr.out
2>&1
192 rm -f $dir/support
/macrosub
193 rm -f $dir/support
/widechr
194 rm -f $dir/support
/*.ali
195 rm -f $dir/support
/*.o
199 # From here, all compilations will be made by the target compiler
201 display_noeol
"Compiling support files..."
204 if [ $?
-ne 0 ]; then
205 display
"**** Failed to compile C code"
209 target_gnatchop
*.adt
>> $dir/acats.log
2>&1
211 target_gnatmake
-c -gnato -gnatE *.ads
>> $dir/acats.log
2>&1
212 target_gnatmake
-c -gnato -gnatE *.adb
>> $dir/acats.log
2>&1
219 display
" === acats tests ==="
221 if [ $# -eq 0 ]; then
222 chapters
=`cd $dir/tests; echo [a-z]*`
234 for chapter
in $chapters; do
235 # Used to generate support once and finish after that.
236 [ "$chapter" = "NONE" ] && continue
238 display Running chapter
$chapter ...
240 if [ ! -d $dir/tests
/$chapter ]; then
241 display
"*** CHAPTER $chapter does not exist, skipping."
246 cd $dir/tests
/$chapter
247 ls *.a
*.ada
*.adt
*.am
*.dep
2> /dev
/null |
sed -e 's/\(.*\)\..*/\1/g' | \
248 cut
-c1-7 |
sort |
uniq |
comm -23 - $dir_support/norun.lst \
249 > $dir/tests
/$chapter/${chapter}.lst
250 countn
=`wc -l < $dir/tests/$chapter/${chapter}.lst`
251 as_fn_arith
$glob_countn + $countn
253 for i
in `cat $dir/tests/$chapter/${chapter}.lst`; do
255 # If running multiple run_all.sh jobs in parallel, decide
256 # if we should run this test in the current instance.
257 if [ -n "$GCC_RUNTEST_PARALLELIZE_DIR" ]; then
259 # Ugh, some tests have inter-test dependencies, those
260 # tests have to be scheduled on the same parallel instance
262 ce2108f | ce2108h | ce3112d
) ;;
263 # All others can be hopefully scheduled freely.
265 as_fn_arith
$par_countm + 1
267 [ $par_countm -eq 10 ] && par_countm
=0
268 if [ $par_countm -eq 1 ]; then
269 as_fn_arith
$par_count + 1
271 if mkdir
$GCC_RUNTEST_PARALLELIZE_DIR/$par_count; then
278 if [ -z "$par_last" ]; then
279 as_fn_arith
$glob_countn - 1
286 grep $i $testdir/overflow.lst
> /dev
/null
2>&1
287 if [ $?
-eq 0 ]; then
288 extraflags
="$extraflags -gnato"
290 grep $i $testdir/elabd.lst
> /dev
/null
2>&1
291 if [ $?
-eq 0 ]; then
292 extraflags
="$extraflags -gnatE"
294 grep $i $testdir/floatstore.lst
> /dev
/null
2>&1
295 if [ $?
-eq 0 ]; then
296 extraflags
="$extraflags -ffloat-store"
298 grep $i $testdir/stackcheck.lst
> /dev
/null
2>&1
299 if [ $?
-eq 0 ]; then
300 extraflags
="$extraflags -fstack-check"
302 test=$dir/tests
/$chapter/$i
303 mkdir
$test && cd $test >> $dir/acats.log
2>&1
305 if [ $?
-ne 0 ]; then
307 failed
="${failed}${i} "
312 target_gnatchop
-c -w `ls ${test}*.a ${test}*.ada ${test}*.adt ${test}*.am ${test}*.dep 2> /dev/null` >> $dir/acats.log
2>&1
315 if [ -z "$main" ]; then
319 binmain
=`echo $main | sed -e 's/\(.*\)\..*/\1/g'`
320 echo "BUILD $main" >> $dir/acats.log
323 cxb30
*) EXTERNAL_OBJECTS
="$dir_support/cxb30040.o $dir_support/cxb30060.o $dir_support/cxb30130.o $dir_support/cxb30131.o";;
324 ca1020e
) rm -f ca1020e_func1.adb ca1020e_func2.adb ca1020e_proc1.adb ca1020e_proc2.adb
> /dev
/null
2>&1;;
325 ca14028
) rm -f ca14028_func2.ads ca14028_func3.ads ca14028_proc1.ads ca14028_proc3.ads
> /dev
/null
2>&1;;
327 if [ "$main" = "" ]; then
329 failed
="${failed}${i} "
334 target_gnatmake
$extraflags -I$dir_support $main >> $dir/acats.log
2>&1
335 if [ $?
-ne 0 ]; then
337 failed
="${failed}${i} "
342 echo "RUN $binmain" >> $dir/acats.log
344 if [ ! -x $dir/tests
/$chapter/$i/$binmain ]; then
347 target_run
$dir/tests
/$chapter/$i/$binmain > $dir/tests
/$chapter/$i/${i}.log
2>&1
348 cd $dir/tests
/$chapter/$i
349 cat ${i}.log
>> $dir/acats.log
350 egrep -e '(==== |\+\+\+\+ |\!\!\!\! )' ${i}.log
> /dev
/null
2>&1
351 if [ $?
-ne 0 ]; then
352 grep 'tasking not implemented' ${i}.log
> /dev
/null
2>&1
354 if [ $?
-ne 0 ]; then
356 failed
="${failed}${i} "
358 log
"UNSUPPORTED: $i"
359 as_fn_arith
$glob_countn - 1
361 as_fn_arith
$glob_countu + 1
366 as_fn_arith
$glob_countok + 1
373 display
" === acats Summary ==="
374 display
"# of expected passes $glob_countok"
375 display
"# of unexpected failures `expr $glob_countn - $glob_countok`"
377 if [ $glob_countu -ne 0 ]; then
378 display
"# of unsupported tests $glob_countu"
381 if [ $glob_countok -ne $glob_countn ]; then
382 display
"*** FAILURES: $failed"
385 display
"$0 completed at `date`"