* dbxout.c (current_file): Also wrap inside DBX_DEBUGGING_INFO ||
[official-gcc.git] / gcc / testsuite / ada / acats / run_all.sh
blobb149fd27e6a36990f58dd05a92cf92b020d20482
1 #!/bin/sh
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"
10 # gnatflags="-gnatN"
12 gccflags=""
13 gnatflags="-q -gnatws"
15 target_run () {
19 # End of customization section.
21 display_noeol () {
22 printf "$@"
23 printf "$@" >> $dir/acats.sum
24 printf "$@" >> $dir/acats.log
27 display () {
28 echo "$@"
29 echo "$@" >> $dir/acats.sum
30 echo "$@" >> $dir/acats.log
33 dir=`pwd`
35 if [ "$testdir" = "" ]; then
36 echo You must use make check or make check-ada
37 exit 1
40 if [ "$dir" = "$testdir" ]; then
41 echo "error: srcdir must be different than objdir, exiting."
42 exit 1
45 target_gnatmake () {
46 gnatmake $gnatflags $gccflags $* -largs $EXTERNAL_OBJECTS
49 target_gcc () {
50 gcc $gccflags $*
53 clean_dir () {
54 rm -f "$binmain" *.o *.ali > /dev/null 2>&1
57 EXTERNAL_OBJECTS=""
58 # Global variable to communicate external objects to link with.
60 rm -f $dir/acats.sum $dir/acats.log
62 display " === CONFIGURATION ==="
64 display `type gcc`
65 display `gcc -v 2>&1`
66 display host=`host_gcc -dumpmachine`
67 display target=`gcc -dumpmachine`
68 display `type gnatmake`
69 gnatls -v >> $dir/acats.log
70 display ""
72 display " === SUPPORT ==="
73 display_noeol "Generating support files..."
75 rm -rf $dir/support
76 mkdir -p $dir/support
77 cd $dir/support
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
91 rm -rf $dir/run
92 mv $dir/tests $dir/tests.$$ 2> /dev/null
93 rm -rf $dir/tests.$$ &
94 mkdir -p $dir/run
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
100 done
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"
108 exit 1
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"
116 exit 1
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
125 display " done."
127 # From here, all compilations will be made by the target compiler
129 display_noeol "Compiling support files..."
131 target_gcc -c *.c
132 if [ $? -ne 0 ]; then
133 display "**** Failed to compile C code"
134 exit 1
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
142 display " done."
143 display ""
144 display " === ACATS tests ==="
146 if [ $# -eq 0 ]; then
147 chapters=`cd $dir/tests; echo [a-z]*`
148 else
149 chapters=$*
152 glob_countn=0
153 glob_countok=0
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."
160 display ""
161 continue
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`
169 countok=0
170 counti=0
171 for i in `cat $dir/tests/$chapter/${chapter}.lst`; do
172 counti=`expr $counti + 1`
173 extraflags=""
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
183 mkdir $test
184 cd $test
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
192 EXTERNAL_OBJECTS=""
193 case $i in
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
198 esac
199 if [ "$main" = "" ]; then
200 display "FAIL: $i"
201 failed="${failed}${i} "
202 clean_dir
203 continue
206 target_gnatmake $extraflags -I$dir/support $main >> $dir/acats.log 2>&1
207 if [ $? -ne 0 ]; then
208 display "FAIL: $i"
209 failed="${failed}${i} "
210 clean_dir
211 continue
214 echo "RUN $binmain" >> $dir/acats.log
215 cd $dir/run
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
221 display "FAIL: $i"
222 failed="${failed}${i} "
223 else
224 echo "PASS: $i" >> $dir/acats.sum
225 echo "PASS: $i" >> $dir/acats.log
226 countok=`expr $countok + 1`
228 clean_dir
229 done
231 glob_countok=`expr $glob_countok + $countok`
232 glob_countn=`expr $glob_countn + $countn`
233 done
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"
243 exit 0