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.
23 printf "$@" >> $dir/acats.
sum
24 printf "$@" >> $dir/acats.log
29 echo "$@" >> $dir/acats.
sum
30 echo "$@" >> $dir/acats.log
34 echo "$@" >> $dir/acats.
sum
35 echo "$@" >> $dir/acats.log
40 if [ "$testdir" = "" ]; then
41 echo You must use
make check or
make check-ada
45 if [ "$dir" = "$testdir" ]; then
46 echo "error: srcdir must be different than objdir, exiting."
51 gnatchop
--GCC="$GCC_DRIVER" $
*
55 echo gnatmake
--GCC=\"$GCC\" $gnatflags $gccflags $
* -largs $EXTERNAL_OBJECTS --GCC=\"$GCC\"
56 gnatmake
--GCC="$GCC" $gnatflags $gccflags $
* -largs $EXTERNAL_OBJECTS --GCC="$GCC"
64 rm -f "$binmain" *.o
*.ali
> /dev
/null
2>&1
68 ls ${i}?.adb
> ${i}.lst
2> /dev
/null
69 ls ${i}*m.adb
>> ${i}.lst
2> /dev
/null
70 ls ${i}.adb
>> ${i}.lst
2> /dev
/null
71 main
=`tail -1 ${i}.lst`
75 # Global variable to communicate external objects to link with.
77 rm -f $dir/acats.
sum $dir/acats.log
79 display
" === acats configuration ==="
81 target
=`$GCC -dumpmachine`
83 display target gcc is
$GCC
84 display
`$GCC -v 2>&1`
85 display
host=`gcc -dumpmachine`
86 display target
=$target
87 display
`type gnatmake`
88 gnatls
-v >> $dir/acats.log
91 display
" === acats support ==="
92 display_noeol
"Generating support files..."
98 cp $testdir/support
/*.ada
$testdir/support
/*.a
$testdir/support
/*.tst
$dir/support
100 # Find out the size in bit of an address on the target
101 target_gnatmake
$testdir/support
/impbit.adb
>> $dir/acats.log
2>&1
102 target_run
$dir/support
/impbit
> $dir/support
/impbit.out
2>&1
103 target_bit
=`cat $dir/support/impbit.out`
104 echo target_bit
="$target_bit" >> $dir/acats.log
106 # Find out a suitable asm statement
107 # Adapted from configure.ac gcc_cv_as_dwarf2_debug_line
109 ia64
*-*-* | s390
*-*-*)
119 echo target_insn
="$target_insn" >> $dir/acats.log
121 sed -e "s,ACATS4GNATDIR,$dir,g" \
122 < $testdir/support
/impdef.a
> $dir/support
/impdef.a
123 sed -e "s,ACATS4GNATDIR,$dir,g" \
124 -e "s,ACATS4GNATBIT,$target_bit,g" \
125 -e "s,ACATS4GNATINSN,$target_insn,g" \
126 < $testdir/support
/macro.dfs
> $dir/support
/MACRO.DFS
127 sed -e "s,ACATS4GNATDIR,$dir,g" \
128 < $testdir/support
/tsttests.dat
> $dir/support
/TSTTESTS.DAT
130 cp $testdir/tests
/cd
/*.c
$dir/support
131 cp $testdir/tests
/cxb
/*.c
$dir/support
132 grep -v '^#' $testdir/norun.lst |
sort > $dir/support
/norun.lst
135 mv $dir/tests
$dir/tests.$$
2> /dev
/null
136 rm -rf $dir/tests.$$
&
139 cp -pr $testdir/tests
$dir/
141 for i
in $dir/support
/*.ada
$dir/support
/*.a
; do
142 host_gnatchop
$i >> $dir/acats.log
2>&1
145 # These tools are used to preprocess some ACATS sources
146 # they need to be compiled native on the host.
148 host_gnatmake
-q -gnatws macrosub.adb
149 if [ $?
-ne 0 ]; then
150 display
"**** Failed to compile macrosub"
153 .
/macrosub
> macrosub.out
2>&1
156 host_gnatmake
-q -gnatws widechr.adb
157 if [ $?
-ne 0 ]; then
158 display
"**** Failed to compile widechr"
161 .
/widechr
> widechr.out
2>&1
163 rm -f $dir/support
/macrosub
164 rm -f $dir/support
/widechr
165 rm -f $dir/support
/*.ali
166 rm -f $dir/support
/*.o
170 # From here, all compilations will be made by the target compiler
172 display_noeol
"Compiling support files..."
175 if [ $?
-ne 0 ]; then
176 display
"**** Failed to compile C code"
180 target_gnatchop
*.adt
>> $dir/acats.log
2>&1
182 target_gnatmake
-c -gnato -gnatE *.ads
>> $dir/acats.log
2>&1
183 target_gnatmake
-c -gnato -gnatE *.adb
>> $dir/acats.log
2>&1
187 display
" === acats tests ==="
189 if [ $# -eq 0 ]; then
190 chapters
=`cd $dir/tests; echo [a-z]*`
199 for chapter
in $chapters; do
200 display Running chapter
$chapter ...
202 if [ ! -d $dir/tests
/$chapter ]; then
203 display
"*** CHAPTER $chapter does not exist, skipping."
208 cd $dir/tests
/$chapter
209 ls *.a
*.ada
*.adt
*.am
*.dep
2> /dev
/null |
sed -e 's/\(.*\)\..*/\1/g' | \
210 cut
-c1-7 |
sort |
uniq |
comm -23 - $dir/support
/norun.lst \
211 > $dir/tests
/$chapter/${chapter}.lst
212 countn
=`wc -l < $dir/tests/$chapter/${chapter}.lst`
213 glob_countn
=`expr $glob_countn + $countn`
215 for i
in `cat $dir/tests/$chapter/${chapter}.lst`; do
216 counti
=`expr $counti + 1`
218 grep $i $testdir/overflow.lst
> /dev
/null
2>&1
219 if [ $?
-eq 0 ]; then
220 extraflags
="$extraflags -gnato"
222 grep $i $testdir/elabd.lst
> /dev
/null
2>&1
223 if [ $?
-eq 0 ]; then
224 extraflags
="$extraflags -gnatE"
226 grep $i $testdir/stackcheck.lst
> /dev
/null
2>&1
227 if [ $?
-eq 0 ]; then
228 extraflags
="$extraflags -fstack-check"
230 grep $i $testdir/ada95.lst
> /dev
/null
2>&1
231 if [ $?
-eq 0 ]; then
232 extraflags
="$extraflags -gnat95"
234 test=$dir/tests
/$chapter/$i
235 mkdir
$test && cd $test >> $dir/acats.log
2>&1
237 if [ $?
-ne 0 ]; then
239 failed
="${failed}${i} "
244 target_gnatchop
-c -w `ls ${test}*.a ${test}*.ada ${test}*.adt ${test}*.am ${test}*.dep 2> /dev/null` >> $dir/acats.log
2>&1
247 if [ -z "$main" ]; then
251 binmain
=`echo $main | sed -e 's/\(.*\)\..*/\1/g'`
252 echo "BUILD $main" >> $dir/acats.log
255 cxb30
*) EXTERNAL_OBJECTS
="$dir/support/cxb30040.o $dir/support/cxb30060.o $dir/support/cxb30130.o $dir/support/cxb30131.o";;
256 ca1020e
) rm -f ca1020e_func1.adb ca1020e_func2.adb ca1020e_proc1.adb ca1020e_proc2.adb
> /dev
/null
2>&1;;
257 ca14028
) rm -f ca14028_func2.ads ca14028_func3.ads ca14028_proc1.ads ca14028_proc3.ads
> /dev
/null
2>&1;;
258 cxh1001
) extraflags
="-a -f"; echo "pragma Normalize_Scalars;" > gnat.adc
260 if [ "$main" = "" ]; then
262 failed
="${failed}${i} "
267 target_gnatmake
$extraflags -I$dir/support
$main >> $dir/acats.log
2>&1
268 if [ $?
-ne 0 ]; then
270 failed
="${failed}${i} "
275 echo "RUN $binmain" >> $dir/acats.log
277 if [ ! -x $dir/tests
/$chapter/$i/$binmain ]; then
280 target_run
$dir/tests
/$chapter/$i/$binmain > $dir/tests
/$chapter/$i/${i}.log
2>&1
281 cd $dir/tests
/$chapter/$i
282 cat ${i}.log
>> $dir/acats.log
283 egrep -e '(==== |\+\+\+\+ |\!\!\!\! )' ${i}.log
> /dev
/null
2>&1
284 if [ $?
-ne 0 ]; then
285 grep 'Tasking not implemented' ${i}.log
> /dev
/null
2>&1
287 if [ $?
-ne 0 ]; then
289 failed
="${failed}${i} "
291 log
"UNSUPPORTED: $i"
292 glob_countn
=`expr $glob_countn - 1`
293 glob_countu
=`expr $glob_countu + 1`
297 glob_countok
=`expr $glob_countok + 1`
303 display
" === acats Summary ==="
304 display
"# of expected passes $glob_countok"
305 display
"# of unexpected failures `expr $glob_countn - $glob_countok`"
307 if [ $glob_countu -ne 0 ]; then
308 display
"# of unsupported tests $glob_countu"
311 if [ $glob_countok -ne $glob_countn ]; then
312 display
"*** FAILURES: $failed"