Merge from mainline (154736:156693)
[official-gcc/graphite-test-results.git] / gcc / testsuite / ada / acats / run_all.sh
bloba5e1c13a5e6aebb0a739b117d9ebdc342ebe2575
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 () {
16 eval $EXPECT -f $testdir/run_test.exp $*
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
132 grep -v '^#' $testdir/norun.lst | sort > $dir/support/norun.lst
134 rm -rf $dir/run
135 mv $dir/tests $dir/tests.$$ 2> /dev/null
136 rm -rf $dir/tests.$$ &
137 mkdir -p $dir/run
139 cp -pr $testdir/tests $dir/
141 for i in $dir/support/*.ada $dir/support/*.a; do
142 host_gnatchop $i >> $dir/acats.log 2>&1
143 done
145 # These tools are used to preprocess some ACATS sources
146 # they need to be compiled native on the host.
148 host_gnatmake -q -gnatws macrosub.adb
149 if [ $? -ne 0 ]; then
150 display "**** Failed to compile macrosub"
151 exit 1
153 ./macrosub > macrosub.out 2>&1
155 gcc -c cd300051.c
156 host_gnatmake -q -gnatws widechr.adb
157 if [ $? -ne 0 ]; then
158 display "**** Failed to compile widechr"
159 exit 1
161 ./widechr > widechr.out 2>&1
163 rm -f $dir/support/macrosub
164 rm -f $dir/support/widechr
165 rm -f $dir/support/*.ali
166 rm -f $dir/support/*.o
168 display " done."
170 # From here, all compilations will be made by the target compiler
172 display_noeol "Compiling support files..."
174 target_gcc -c *.c
175 if [ $? -ne 0 ]; then
176 display "**** Failed to compile C code"
177 exit 1
180 target_gnatchop *.adt >> $dir/acats.log 2>&1
182 target_gnatmake -c -gnato -gnatE *.ads >> $dir/acats.log 2>&1
183 target_gnatmake -c -gnato -gnatE *.adb >> $dir/acats.log 2>&1
185 display " done."
186 display ""
187 display " === acats tests ==="
189 if [ $# -eq 0 ]; then
190 chapters=`cd $dir/tests; echo [a-z]*`
191 else
192 chapters=$*
195 glob_countn=0
196 glob_countok=0
197 glob_countu=0
199 for chapter in $chapters; do
200 display Running chapter $chapter ...
202 if [ ! -d $dir/tests/$chapter ]; then
203 display "*** CHAPTER $chapter does not exist, skipping."
204 display ""
205 continue
208 cd $dir/tests/$chapter
209 ls *.a *.ada *.adt *.am *.dep 2> /dev/null | sed -e 's/\(.*\)\..*/\1/g' | \
210 cut -c1-7 | sort | uniq | comm -23 - $dir/support/norun.lst \
211 > $dir/tests/$chapter/${chapter}.lst
212 countn=`wc -l < $dir/tests/$chapter/${chapter}.lst`
213 glob_countn=`expr $glob_countn + $countn`
214 counti=0
215 for i in `cat $dir/tests/$chapter/${chapter}.lst`; do
216 counti=`expr $counti + 1`
217 extraflags=""
218 grep $i $testdir/overflow.lst > /dev/null 2>&1
219 if [ $? -eq 0 ]; then
220 extraflags="$extraflags -gnato"
222 grep $i $testdir/elabd.lst > /dev/null 2>&1
223 if [ $? -eq 0 ]; then
224 extraflags="$extraflags -gnatE"
226 grep $i $testdir/stackcheck.lst > /dev/null 2>&1
227 if [ $? -eq 0 ]; then
228 extraflags="$extraflags -fstack-check"
230 grep $i $testdir/ada95.lst > /dev/null 2>&1
231 if [ $? -eq 0 ]; then
232 extraflags="$extraflags -gnat95"
234 test=$dir/tests/$chapter/$i
235 mkdir $test && cd $test >> $dir/acats.log 2>&1
237 if [ $? -ne 0 ]; then
238 display "FAIL: $i"
239 failed="${failed}${i} "
240 clean_dir
241 continue
244 target_gnatchop -c -w `ls ${test}*.a ${test}*.ada ${test}*.adt ${test}*.am ${test}*.dep 2> /dev/null` >> $dir/acats.log 2>&1
245 main=""
246 find_main
247 if [ -z "$main" ]; then
248 sync
249 find_main
251 binmain=`echo $main | sed -e 's/\(.*\)\..*/\1/g'`
252 echo "BUILD $main" >> $dir/acats.log
253 EXTERNAL_OBJECTS=""
254 case $i in
255 cxb30*) EXTERNAL_OBJECTS="$dir/support/cxb30040.o $dir/support/cxb30060.o $dir/support/cxb30130.o $dir/support/cxb30131.o";;
256 ca1020e) rm -f ca1020e_func1.adb ca1020e_func2.adb ca1020e_proc1.adb ca1020e_proc2.adb > /dev/null 2>&1;;
257 ca14028) rm -f ca14028_func2.ads ca14028_func3.ads ca14028_proc1.ads ca14028_proc3.ads > /dev/null 2>&1;;
258 cxh1001) extraflags="-a -f"; echo "pragma Normalize_Scalars;" > gnat.adc
259 esac
260 if [ "$main" = "" ]; then
261 display "FAIL: $i"
262 failed="${failed}${i} "
263 clean_dir
264 continue
267 target_gnatmake $extraflags -I$dir/support $main >> $dir/acats.log 2>&1
268 if [ $? -ne 0 ]; then
269 display "FAIL: $i"
270 failed="${failed}${i} "
271 clean_dir
272 continue
275 echo "RUN $binmain" >> $dir/acats.log
276 cd $dir/run
277 if [ ! -x $dir/tests/$chapter/$i/$binmain ]; then
278 sync
280 target_run $dir/tests/$chapter/$i/$binmain > $dir/tests/$chapter/$i/${i}.log 2>&1
281 cd $dir/tests/$chapter/$i
282 cat ${i}.log >> $dir/acats.log
283 egrep -e '(==== |\+\+\+\+ |\!\!\!\! )' ${i}.log > /dev/null 2>&1
284 if [ $? -ne 0 ]; then
285 grep 'Tasking not implemented' ${i}.log > /dev/null 2>&1
287 if [ $? -ne 0 ]; then
288 display "FAIL: $i"
289 failed="${failed}${i} "
290 else
291 log "UNSUPPORTED: $i"
292 glob_countn=`expr $glob_countn - 1`
293 glob_countu=`expr $glob_countu + 1`
295 else
296 log "PASS: $i"
297 glob_countok=`expr $glob_countok + 1`
299 clean_dir
300 done
301 done
303 display " === acats Summary ==="
304 display "# of expected passes $glob_countok"
305 display "# of unexpected failures `expr $glob_countn - $glob_countok`"
307 if [ $glob_countu -ne 0 ]; then
308 display "# of unsupported tests $glob_countu"
311 if [ $glob_countok -ne $glob_countn ]; then
312 display "*** FAILURES: $failed"
315 exit 0