* c-common.c (get_priority): Add check for
[official-gcc.git] / gcc / testsuite / ada / acats / run_all.sh
blobddd4da0f300d279cca0444d90b56fe19f1e57cba
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="-O2"
13 gnatflags="-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 log () {
34 echo "$@" >> $dir/acats.sum
35 echo "$@" >> $dir/acats.log
38 dir=`${PWDCMD-pwd}`
40 if [ "$testdir" = "" ]; then
41 echo You must use make check or make check-ada
42 exit 1
45 if [ "$dir" = "$testdir" ]; then
46 echo "error: srcdir must be different than objdir, exiting."
47 exit 1
50 target_gnatchop () {
51 gnatchop --GCC="$GCC_DRIVER" $*
54 target_gnatmake () {
55 echo gnatmake --GCC=\"$GCC\" $gnatflags $gccflags $* -largs $EXTERNAL_OBJECTS --GCC=\"$GCC\"
56 gnatmake --GCC="$GCC" $gnatflags $gccflags $* -largs $EXTERNAL_OBJECTS --GCC="$GCC"
59 target_gcc () {
60 $GCC $gccflags $*
63 clean_dir () {
64 rm -f "$binmain" *.o *.ali > /dev/null 2>&1
67 find_main () {
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`
74 EXTERNAL_OBJECTS=""
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
89 display ""
91 display " === acats support ==="
92 display_noeol "Generating support files..."
94 rm -rf $dir/support
95 mkdir -p $dir/support
96 cd $dir/support
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
108 case "$target" in
109 ia64*-*-* | s390*-*-*)
110 target_insn="nop 0"
112 mmix-*-*)
113 target_insn="swym 0"
116 target_insn="nop"
118 esac
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
133 rm -rf $dir/run
134 mv $dir/tests $dir/tests.$$ 2> /dev/null
135 rm -rf $dir/tests.$$ &
136 mkdir -p $dir/run
138 cp -pr $testdir/tests $dir/
140 for i in $dir/support/*.ada $dir/support/*.a; do
141 host_gnatchop $i >> $dir/acats.log 2>&1
142 done
144 # These tools are used to preprocess some ACATS sources
145 # they need to be compiled native on the host.
147 host_gnatmake -q -gnatws macrosub.adb
148 if [ $? -ne 0 ]; then
149 display "**** Failed to compile macrosub"
150 exit 1
152 ./macrosub > macrosub.out 2>&1
154 gcc -c cd300051.c
155 host_gnatmake -q -gnatws widechr.adb
156 if [ $? -ne 0 ]; then
157 display "**** Failed to compile widechr"
158 exit 1
160 ./widechr > widechr.out 2>&1
162 rm -f $dir/support/macrosub
163 rm -f $dir/support/widechr
164 rm -f $dir/support/*.ali
165 rm -f $dir/support/*.o
167 display " done."
169 # From here, all compilations will be made by the target compiler
171 display_noeol "Compiling support files..."
173 target_gcc -c *.c
174 if [ $? -ne 0 ]; then
175 display "**** Failed to compile C code"
176 exit 1
179 target_gnatchop *.adt >> $dir/acats.log 2>&1
181 target_gnatmake -c -gnato -gnatE *.ads >> $dir/acats.log 2>&1
182 target_gnatmake -c -gnato -gnatE *.adb >> $dir/acats.log 2>&1
184 display " done."
185 display ""
186 display " === acats tests ==="
188 if [ $# -eq 0 ]; then
189 chapters=`cd $dir/tests; echo [a-z]*`
190 else
191 chapters=$*
194 glob_countn=0
195 glob_countok=0
196 glob_countu=0
198 for chapter in $chapters; do
199 display Running chapter $chapter ...
201 if [ ! -d $dir/tests/$chapter ]; then
202 display "*** CHAPTER $chapter does not exist, skipping."
203 display ""
204 continue
207 cd $dir/tests/$chapter
208 ls *.a *.ada *.adt *.am *.dep 2> /dev/null | sed -e 's/\(.*\)\..*/\1/g' | \
209 cut -c1-7 | sort | uniq | comm -23 - $testdir/norun.lst \
210 > $dir/tests/$chapter/${chapter}.lst
211 countn=`wc -l < $dir/tests/$chapter/${chapter}.lst`
212 glob_countn=`expr $glob_countn + $countn`
213 counti=0
214 for i in `cat $dir/tests/$chapter/${chapter}.lst`; do
215 counti=`expr $counti + 1`
216 extraflags=""
217 grep $i $testdir/overflow.lst > /dev/null 2>&1
218 if [ $? -eq 0 ]; then
219 extraflags="$extraflags -gnato"
221 grep $i $testdir/elabd.lst > /dev/null 2>&1
222 if [ $? -eq 0 ]; then
223 extraflags="$extraflags -gnatE"
225 grep $i $testdir/stackcheck.lst > /dev/null 2>&1
226 if [ $? -eq 0 ]; then
227 extraflags="$extraflags -fstack-check"
229 grep $i $testdir/ada95.lst > /dev/null 2>&1
230 if [ $? -eq 0 ]; then
231 extraflags="$extraflags -gnat95"
233 test=$dir/tests/$chapter/$i
234 mkdir $test && cd $test >> $dir/acats.log 2>&1
236 if [ $? -ne 0 ]; then
237 display "FAIL: $i"
238 failed="${failed}${i} "
239 clean_dir
240 continue
243 target_gnatchop -c -w `ls ${test}*.a ${test}*.ada ${test}*.adt ${test}*.am ${test}*.dep 2> /dev/null` >> $dir/acats.log 2>&1
244 main=""
245 find_main
246 if [ -z "$main" ]; then
247 sync
248 find_main
250 binmain=`echo $main | sed -e 's/\(.*\)\..*/\1/g'`
251 echo "BUILD $main" >> $dir/acats.log
252 EXTERNAL_OBJECTS=""
253 case $i in
254 cxb30*) EXTERNAL_OBJECTS="$dir/support/cxb30040.o $dir/support/cxb30060.o $dir/support/cxb30130.o $dir/support/cxb30131.o";;
255 ca1020e) rm -f ca1020e_func1.adb ca1020e_func2.adb ca1020e_proc1.adb ca1020e_proc2.adb > /dev/null 2>&1;;
256 ca14028) rm -f ca14028_func2.ads ca14028_func3.ads ca14028_proc1.ads ca14028_proc3.ads > /dev/null 2>&1;;
257 cxh1001) extraflags="-a -f"; echo "pragma Normalize_Scalars;" > gnat.adc
258 esac
259 if [ "$main" = "" ]; then
260 display "FAIL: $i"
261 failed="${failed}${i} "
262 clean_dir
263 continue
266 target_gnatmake $extraflags -I$dir/support $main >> $dir/acats.log 2>&1
267 if [ $? -ne 0 ]; then
268 display "FAIL: $i"
269 failed="${failed}${i} "
270 clean_dir
271 continue
274 echo "RUN $binmain" >> $dir/acats.log
275 cd $dir/run
276 if [ ! -x $dir/tests/$chapter/$i/$binmain ]; then
277 sync
279 target_run $dir/tests/$chapter/$i/$binmain > $dir/tests/$chapter/$i/${i}.log 2>&1
280 cd $dir/tests/$chapter/$i
281 cat ${i}.log >> $dir/acats.log
282 egrep -e '(==== |\+\+\+\+ |\!\!\!\! )' ${i}.log > /dev/null 2>&1
283 if [ $? -ne 0 ]; then
284 grep 'Tasking not implemented' ${i}.log > /dev/null 2>&1
286 if [ $? -ne 0 ]; then
287 display "FAIL: $i"
288 failed="${failed}${i} "
289 else
290 log "UNSUPPORTED: $i"
291 glob_countn=`expr $glob_countn - 1`
292 glob_countu=`expr $glob_countu + 1`
294 else
295 log "PASS: $i"
296 glob_countok=`expr $glob_countok + 1`
298 clean_dir
299 done
300 done
302 display " === acats Summary ==="
303 display "# of expected passes $glob_countok"
304 display "# of unexpected failures `expr $glob_countn - $glob_countok`"
306 if [ $glob_countu -ne 0 ]; then
307 display "# of unsupported tests $glob_countu"
310 if [ $glob_countok -ne $glob_countn ]; then
311 display "*** FAILURES: $failed"
314 exit 0