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"
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 # Global variable to communicate external objects to link with.
70 rm -f $dir/acats.sum $dir/acats.log
72 display " === acats configuration ==="
74 target=`$GCC -dumpmachine`
76 display target gcc is $GCC
77 display `$GCC -v 2>&1`
78 display host=`gcc -dumpmachine`
79 display target=$target
80 display `type gnatmake`
81 gnatls -v >> $dir/acats.log
84 display " === acats support ==="
85 display_noeol "Generating support files..."
91 cp $testdir/support/*.ada $testdir/support/*.a $testdir/support/*.tst $dir/support
93 # Find out the size in bit of an address on the target
94 target_gnatmake $testdir/support/impbit.adb >> $dir/acats.log 2>&1
95 target_run $dir/support/impbit > $dir/support/impbit.out 2>&1
96 target_bit=`cat $dir/support/impbit.out`
97 echo target_bit="$target_bit" >> $dir/acats.log
99 # Find out a suitable asm statement
100 # Adapted from configure.ac gcc_cv_as_dwarf2_debug_line
102 ia64*-*-* | s390*-*-*)
112 echo target_insn="$target_insn" >> $dir/acats.log
114 sed -e "s,ACATS4GNATDIR,$dir,g" \
115 < $testdir/support/impdef.a > $dir/support/impdef.a
116 sed -e "s,ACATS4GNATDIR,$dir,g" \
117 -e "s,ACATS4GNATBIT,$target_bit,g" \
118 -e "s,ACATS4GNATINSN,$target_insn,g" \
119 < $testdir/support/macro.dfs > $dir/support/MACRO.DFS
120 sed -e "s,ACATS4GNATDIR,$dir,g" \
121 < $testdir/support/tsttests.dat > $dir/support/TSTTESTS.DAT
123 cp $testdir/tests/cd/*.c $dir/support
124 cp $testdir/tests/cxb/*.c $dir/support
127 mv $dir/tests $dir/tests.$$ 2> /dev/null
128 rm -rf $dir/tests.$$ &
131 cp -pr $testdir/tests $dir/
133 for i in $dir/support/*.ada $dir/support/*.a; do
134 host_gnatchop $i >> $dir/acats.log 2>&1
137 # These tools are used to preprocess some ACATS sources
138 # they need to be compiled native on the host.
140 host_gnatmake -q -gnatws macrosub.adb
141 if [ $? -ne 0 ]; then
142 display "**** Failed to compile macrosub"
145 ./macrosub > macrosub.out 2>&1
148 host_gnatmake -q -gnatws widechr.adb
149 if [ $? -ne 0 ]; then
150 display "**** Failed to compile widechr"
153 ./widechr > widechr.out 2>&1
155 rm -f $dir/support/macrosub
156 rm -f $dir/support/widechr
157 rm -f $dir/support/*.ali
158 rm -f $dir/support/*.o
162 # From here, all compilations will be made by the target compiler
164 display_noeol "Compiling support files..."
167 if [ $? -ne 0 ]; then
168 display "**** Failed to compile C code"
172 target_gnatchop *.adt >> $dir/acats.log 2>&1
174 target_gnatmake -c -gnato -gnatE *.ads >> $dir/acats.log 2>&1
175 target_gnatmake -c -gnato -gnatE *.adb >> $dir/acats.log 2>&1
179 display " === acats tests ==="
181 if [ $# -eq 0 ]; then
182 chapters=`cd $dir/tests; echo [a-z]*`
191 for chapter in $chapters; do
192 display Running chapter $chapter ...
194 if [ ! -d $dir/tests/$chapter ]; then
195 display "*** CHAPTER $chapter does not exist, skipping."
200 cd $dir/tests/$chapter
201 ls *.a *.ada *.adt *.am *.dep 2> /dev/null | sed -e 's/\(.*\)\..*/\1/g' | \
202 cut -c1-7 | sort | uniq | comm -23 - $testdir/norun.lst \
203 > $dir/tests/$chapter/${chapter}.lst
204 countn=`wc -l < $dir/tests/$chapter/${chapter}.lst`
205 glob_countn=`expr $glob_countn + $countn`
207 for i in `cat $dir/tests/$chapter/${chapter}.lst`; do
208 counti=`expr $counti + 1`
210 grep $i $testdir/overflow.lst > /dev/null 2>&1
211 if [ $? -eq 0 ]; then
212 extraflags="$extraflags -gnato"
214 grep $i $testdir/elabd.lst > /dev/null 2>&1
215 if [ $? -eq 0 ]; then
216 extraflags="$extraflags -gnatE"
218 grep $i $testdir/stackcheck.lst > /dev/null 2>&1
219 if [ $? -eq 0 ]; then
220 extraflags="$extraflags -fstack-check"
222 test=$dir/tests/$chapter/$i
223 mkdir $test && cd $test >> $dir/acats.log 2>&1
225 if [ $? -ne 0 ]; then
227 failed="${failed}${i} "
232 target_gnatchop -c -w `ls ${test}*.a ${test}*.ada ${test}*.adt ${test}*.am ${test}*.dep 2> /dev/null` >> $dir/acats.log 2>&1
233 ls ${i}?.adb > ${i}.lst 2> /dev/null
234 ls ${i}*m.adb >> ${i}.lst 2> /dev/null
235 ls ${i}.adb >> ${i}.lst 2> /dev/null
236 main=`tail -1 ${i}.lst`
237 binmain=`echo $main | sed -e 's/\(.*\)\..*/\1/g'`
238 echo "BUILD $main" >> $dir/acats.log
241 cxb30*) EXTERNAL_OBJECTS="$dir/support/cxb30040.o $dir/support/cxb30060.o $dir/support/cxb30130.o $dir/support/cxb30131.o";;
242 ca1020e) rm -f ca1020e_func1.adb ca1020e_func2.adb ca1020e_proc1.adb ca1020e_proc2.adb > /dev/null 2>&1;;
243 ca14028) rm -f ca14028_func2.ads ca14028_func3.ads ca14028_proc1.ads ca14028_proc3.ads > /dev/null 2>&1;;
244 cxh1001) extraflags="-a -f"; echo "pragma Normalize_Scalars;" > gnat.adc
246 if [ "$main" = "" ]; then
248 failed="${failed}${i} "
253 target_gnatmake $extraflags -I$dir/support $main >> $dir/acats.log 2>&1
254 if [ $? -ne 0 ]; then
256 failed="${failed}${i} "
261 echo "RUN $binmain" >> $dir/acats.log
263 if [ ! -x $dir/tests/$chapter/$i/$binmain ]; then
266 target_run $dir/tests/$chapter/$i/$binmain > $dir/tests/$chapter/$i/${i}.log 2>&1
267 cd $dir/tests/$chapter/$i
268 cat ${i}.log >> $dir/acats.log
269 egrep -e '(==== |\+\+\+\+ |\!\!\!\! )' ${i}.log > /dev/null 2>&1
270 if [ $? -ne 0 ]; then
271 grep 'Tasking not implemented' ${i}.log > /dev/null 2>&1
273 if [ $? -ne 0 ]; then
275 failed="${failed}${i} "
277 log "UNSUPPORTED: $i"
278 glob_countn=`expr $glob_countn - 1`
279 glob_countu=`expr $glob_countu + 1`
283 glob_countok=`expr $glob_countok + 1`
289 display " === acats Summary ==="
290 display "# of expected passes $glob_countok"
291 display "# of unexpected failures `expr $glob_countn - $glob_countok`"
293 if [ $glob_countu -ne 0 ]; then
294 display "# of unsupported tests $glob_countu"
297 if [ $glob_countok -ne $glob_countn ]; then
298 display "*** FAILURES: $failed"