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 display target gcc is $GCC
75 display `$GCC -v 2>&1`
76 display host=`gcc -dumpmachine`
77 display target=`$GCC -dumpmachine`
78 display `type gnatmake`
79 gnatls -v >> $dir/acats.log
82 display " === acats support ==="
83 display_noeol "Generating support files..."
89 cp $testdir/support/*.ada $testdir/support/*.a $testdir/support/*.tst $dir/support
91 sed -e "s,ACATS4GNATDIR,$dir,g" \
92 < $testdir/support/impdef.a > $dir/support/impdef.a
93 sed -e "s,ACATS4GNATDIR,$dir,g" \
94 < $testdir/support/macro.dfs > $dir/support/MACRO.DFS
95 sed -e "s,ACATS4GNATDIR,$dir,g" \
96 < $testdir/support/tsttests.dat > $dir/support/TSTTESTS.DAT
98 cp $testdir/tests/cd/*.c $dir/support
99 cp $testdir/tests/cxb/*.c $dir/support
102 mv $dir/tests $dir/tests.$$ 2> /dev/null
103 rm -rf $dir/tests.$$ &
106 cp -pr $testdir/tests $dir/
108 for i in $dir/support/*.ada $dir/support/*.a; do
109 host_gnatchop $i >> $dir/acats.log 2>&1
112 # These tools are used to preprocess some ACATS sources
113 # they need to be compiled native on the host.
115 host_gnatmake -q -gnatws macrosub.adb
116 if [ $? -ne 0 ]; then
117 display "**** Failed to compile macrosub"
120 ./macrosub > macrosub.out 2>&1
123 host_gnatmake -q -gnatws widechr.adb
124 if [ $? -ne 0 ]; then
125 display "**** Failed to compile widechr"
128 ./widechr > widechr.out 2>&1
130 rm -f $dir/support/macrosub
131 rm -f $dir/support/widechr
132 rm -f $dir/support/*.ali
133 rm -f $dir/support/*.o
137 # From here, all compilations will be made by the target compiler
139 display_noeol "Compiling support files..."
142 if [ $? -ne 0 ]; then
143 display "**** Failed to compile C code"
147 target_gnatchop *.adt >> $dir/acats.log 2>&1
149 target_gnatmake -c -gnato -gnatE *.ads >> $dir/acats.log 2>&1
150 target_gnatmake -c -gnato -gnatE *.adb >> $dir/acats.log 2>&1
154 display " === acats tests ==="
156 if [ $# -eq 0 ]; then
157 chapters=`cd $dir/tests; echo [a-z]*`
166 for chapter in $chapters; do
167 display Running chapter $chapter ...
169 if [ ! -d $dir/tests/$chapter ]; then
170 display "*** CHAPTER $chapter does not exist, skipping."
175 cd $dir/tests/$chapter
176 ls *.a *.ada *.adt *.am *.dep 2> /dev/null | sed -e 's/\(.*\)\..*/\1/g' | \
177 cut -c1-7 | sort | uniq | comm -23 - $testdir/norun.lst \
178 > $dir/tests/$chapter/${chapter}.lst
179 countn=`wc -l < $dir/tests/$chapter/${chapter}.lst`
180 glob_countn=`expr $glob_countn + $countn`
182 for i in `cat $dir/tests/$chapter/${chapter}.lst`; do
183 counti=`expr $counti + 1`
185 grep $i $testdir/overflow.lst > /dev/null 2>&1
186 if [ $? -eq 0 ]; then
187 extraflags="$extraflags -gnato"
189 grep $i $testdir/elabd.lst > /dev/null 2>&1
190 if [ $? -eq 0 ]; then
191 extraflags="$extraflags -gnatE"
193 test=$dir/tests/$chapter/$i
196 target_gnatchop -c -w `ls ${test}*.a ${test}*.ada ${test}*.adt ${test}*.am ${test}*.dep 2> /dev/null` >> $dir/acats.log 2>&1
197 ls ${i}?.adb > ${i}.lst 2> /dev/null
198 ls ${i}*m.adb >> ${i}.lst 2> /dev/null
199 ls ${i}.adb >> ${i}.lst 2> /dev/null
200 main=`tail -1 ${i}.lst`
201 binmain=`echo $main | sed -e 's/\(.*\)\..*/\1/g'`
202 echo "BUILD $main" >> $dir/acats.log
205 cxb30*) EXTERNAL_OBJECTS="$dir/support/cxb30040.o $dir/support/cxb30060.o $dir/support/cxb30130.o $dir/support/cxb30131.o";;
206 ca1020e) rm -f ca1020e_func1.adb ca1020e_func2.adb ca1020e_proc1.adb ca1020e_proc2.adb > /dev/null 2>&1;;
207 ca14028) rm -f ca14028_func2.ads ca14028_func3.ads ca14028_proc1.ads ca14028_proc3.ads > /dev/null 2>&1;;
208 cxh1001) extraflags="-a -f"; echo "pragma Normalize_Scalars;" > gnat.adc
210 if [ "$main" = "" ]; then
212 failed="${failed}${i} "
217 target_gnatmake $extraflags -I$dir/support $main >> $dir/acats.log 2>&1
218 if [ $? -ne 0 ]; then
220 failed="${failed}${i} "
225 echo "RUN $binmain" >> $dir/acats.log
227 target_run $dir/tests/$chapter/$i/$binmain > $dir/tests/$chapter/$i/${i}.log 2>&1
228 cd $dir/tests/$chapter/$i
229 cat ${i}.log >> $dir/acats.log
230 egrep -e '(==== |\+\+\+\+ |\!\!\!\! )' ${i}.log > /dev/null 2>&1
231 if [ $? -ne 0 ]; then
232 grep 'Tasking not implemented' ${i}.log > /dev/null 2>&1
234 if [ $? -ne 0 ]; then
236 failed="${failed}${i} "
238 log "UNSUPPORTED: $i"
239 glob_countn=`expr $glob_countn - 1`
240 glob_countu=`expr $glob_countu + 1`
244 glob_countok=`expr $glob_countok + 1`
250 display " === acats Summary ==="
251 display "# of expected passes $glob_countok"
252 display "# of unexpected failures `expr $glob_countn - $glob_countok`"
254 if [ $glob_countu -ne 0 ]; then
255 display "# of unsupported tests $glob_countu"
258 if [ $glob_countok -ne $glob_countn ]; then
259 display "*** FAILURES: $failed"