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"
13 gnatflags
="-q -gnatws"
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
35 if [ "$testdir" = "" ]; then
36 echo You must use
make check or
make check-ada
40 if [ "$dir" = "$testdir" ]; then
41 echo "error: srcdir must be different than objdir, exiting."
46 gnatmake
$gnatflags $gccflags $
* -largs $EXTERNAL_OBJECTS
54 rm -f "$binmain" *.o
*.ali
> /dev
/null
2>&1
58 # Global variable to communicate external objects to link with.
60 rm -f $dir/acats.
sum $dir/acats.log
62 display
" === CONFIGURATION ==="
66 display
host=`host_gcc -dumpmachine`
67 display target
=`gcc -dumpmachine`
68 display
`type gnatmake`
69 gnatls
-v >> $dir/acats.log
72 display
" === SUPPORT ==="
73 display_noeol
"Generating support files..."
79 cp $testdir/support
/*.ada
$testdir/support
/*.a
$testdir/support
/*.tst
$dir/support
81 sed -e "s,ACATS4GNATDIR,$dir,g" \
82 < $testdir/support
/impdef.a
> $dir/support
/impdef.a
83 sed -e "s,ACATS4GNATDIR,$dir,g" \
84 < $testdir/support
/macro.dfs
> $dir/support
/MACRO.DFS
85 sed -e "s,ACATS4GNATDIR,$dir,g" \
86 < $testdir/support
/tsttests.dat
> $dir/support
/TSTTESTS.DAT
88 cp $testdir/tests
/cd
/*.c
$dir/support
89 cp $testdir/tests
/cxb
/*.c
$dir/support
92 mv $dir/tests
$dir/tests.$$
2> /dev
/null
93 rm -rf $dir/tests.$$
&
96 cp -pr $testdir/tests
$dir/
98 for i
in $dir/support
/*.ada
$dir/support
/*.a
; do
99 gnatchop
$i >> $dir/acats.log
2>&1
102 # These tools are used to preprocess some ACATS sources
103 # they need to be compiled native on the host.
105 host_gnatmake
-q -gnatws macrosub.adb
106 if [ $?
-ne 0 ]; then
107 display
"**** Failed to compile macrosub"
110 .
/macrosub
> macrosub.out
2>&1
112 host_gcc
-c cd300051.c
113 host_gnatmake
-q -gnatws widechr.adb
114 if [ $?
-ne 0 ]; then
115 display
"**** Failed to compile widechr"
118 .
/widechr
> widechr.out
2>&1
120 rm -f $dir/support
/macrosub
121 rm -f $dir/support
/widechr
122 rm -f $dir/support
/*.ali
123 rm -f $dir/support
/*.o
127 # From here, all compilations will be made by the target compiler
129 display_noeol
"Compiling support files..."
132 if [ $?
-ne 0 ]; then
133 display
"**** Failed to compile C code"
137 gnatchop
*.adt
>> $dir/acats.log
2>&1
139 target_gnatmake
-c -gnato -gnatE *.ads
> /dev
/null
2>&1
140 target_gnatmake
-c -gnato -gnatE *.adb
144 display
" === ACATS tests ==="
146 if [ $# -eq 0 ]; then
147 chapters
=`cd $dir/tests; echo [a-z]*`
155 for chapter
in $chapters; do
156 display Running chapter
$chapter ...
158 if [ ! -d $dir/tests
/$chapter ]; then
159 display
"*** CHAPTER $chapter does not exist, skipping."
164 cd $dir/tests
/$chapter
165 ls *.a
*.ada
*.adt
*.am
*.dep
2> /dev
/null |
sed -e 's/\(.*\)\..*/\1/g' | \
166 cut
-c1-7 |
sort |
uniq |
comm -23 - $testdir/norun.lst \
167 > $dir/tests
/$chapter/${chapter}.lst
168 countn
=`wc -l < $dir/tests/$chapter/${chapter}.lst`
171 for i
in `cat $dir/tests/$chapter/${chapter}.lst`; do
172 counti
=`expr $counti + 1`
174 grep $i $testdir/overflow.lst
> /dev
/null
2>&1
175 if [ $?
-eq 0 ]; then
176 extraflags
="$extraflags -gnato"
178 grep $i $testdir/elabd.lst
> /dev
/null
2>&1
179 if [ $?
-eq 0 ]; then
180 extraflags
="$extraflags -gnatE"
182 test=$dir/tests
/$chapter/$i
185 gnatchop
-c -w `ls ${test}*.a ${test}*.ada ${test}*.adt ${test}*.am ${test}*.dep 2> /dev/null` >> $dir/acats.log
2>&1
186 ls ${i}?.adb
> ${i}.lst
2> /dev
/null
187 ls ${i}*m.adb
>> ${i}.lst
2> /dev
/null
188 ls ${i}.adb
>> ${i}.lst
2> /dev
/null
189 main
=`tail -1 ${i}.lst`
190 binmain
=`echo $main | sed -e 's/\(.*\)\..*/\1/g'`
191 echo "BUILD $main" >> $dir/acats.log
194 cxb30
*) EXTERNAL_OBJECTS
="$dir/support/cxb30040.o $dir/support/cxb30060.o $dir/support/cxb30130.o $dir/support/cxb30131.o";;
195 ca1020e
) rm -f ca1020e_func1.adb ca1020e_func2.adb ca1020e_proc1.adb ca1020e_proc2.adb
> /dev
/null
2>&1;;
196 ca14028
) rm -f ca14028_func2.ads ca14028_func3.ads ca14028_proc1.ads ca14028_proc3.ads
> /dev
/null
2>&1;;
197 cxh1001
) extraflags
="-a -f"; echo "pragma Normalize_Scalars;" > gnat.adc
199 if [ "$main" = "" ]; then
201 failed
="${failed}${i} "
206 target_gnatmake
$extraflags -I$dir/support
$main >> $dir/acats.log
2>&1
207 if [ $?
-ne 0 ]; then
209 failed
="${failed}${i} "
214 echo "RUN $binmain" >> $dir/acats.log
216 target_run
$dir/tests
/$chapter/$i/$binmain > $dir/tests
/$chapter/$i/${i}.log
2>&1
217 cd $dir/tests
/$chapter/$i
218 cat ${i}.log
>> $dir/acats.log
219 egrep -e '(==== |\+\+\+\+ |\!\!\!\! )' ${i}.log
> /dev
/null
2>&1
220 if [ $?
-ne 0 ]; then
222 failed
="${failed}${i} "
224 echo "PASS: $i" >> $dir/acats.
sum
225 echo "PASS: $i" >> $dir/acats.log
226 countok
=`expr $countok + 1`
231 glob_countok
=`expr $glob_countok + $countok`
232 glob_countn
=`expr $glob_countn + $countn`
235 display
" === ACATS Summary ==="
236 display
"# of expected passes $glob_countok"
237 display
"# of unexpected failures `expr $glob_countn - $glob_countok`"
239 if [ $glob_countok -ne $glob_countn ]; then
240 display
"*** FAILURES: $failed"