111
|
1 #!/bin/sh
|
|
2 # Run ACATS with the GNU Ada compiler
|
|
3
|
|
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).
|
|
8
|
|
9 # gccflags="-O3 -fomit-frame-pointer -funroll-all-loops -finline-functions"
|
|
10 # gnatflags="-gnatN"
|
|
11
|
|
12 gccflags="-O2"
|
|
13 gnatflags="-gnatws"
|
|
14
|
|
15 # End of customization section.
|
|
16
|
|
17 # Perform arithmetic evaluation on the ARGs, and store the result in the
|
|
18 # global $as_val. Take advantage of shells that can avoid forks. The arguments
|
|
19 # must be portable across $(()) and expr.
|
|
20 if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
|
|
21 eval 'as_fn_arith ()
|
|
22 {
|
|
23 as_val=$(( $* ))
|
|
24 }'
|
|
25 else
|
|
26 as_fn_arith ()
|
|
27 {
|
|
28 as_val=`expr "$@" || test $? -eq 1`
|
|
29 }
|
|
30 fi # as_fn_arith
|
|
31
|
|
32 display_noeol () {
|
|
33 printf "$@"
|
|
34 printf "$@" >> $dir/acats.sum
|
|
35 printf "$@" >> $dir/acats.log
|
|
36 }
|
|
37
|
|
38 display () {
|
|
39 echo "$@"
|
|
40 echo "$@" >> $dir/acats.sum
|
|
41 echo "$@" >> $dir/acats.log
|
|
42 }
|
|
43
|
|
44 log () {
|
|
45 echo "$@" >> $dir/acats.sum
|
|
46 echo "$@" >> $dir/acats.log
|
|
47 }
|
|
48
|
|
49 dir=`${PWDCMD-pwd}`
|
|
50
|
|
51 if [ "$dir" = "$testdir" ]; then
|
|
52 echo "error: srcdir must be different than objdir, exiting."
|
|
53 exit 1
|
|
54 fi
|
|
55
|
|
56 GCC="$BASE/xgcc -B$BASE/"
|
|
57
|
|
58 target_gnatchop () {
|
|
59 $BASE/gnatchop --GCC="$BASE/xgcc" $*
|
|
60 }
|
|
61
|
|
62 target_gnatmake () {
|
|
63 echo $BASE/gnatmake --GNATBIND=$BASE/gnatbind --GNATLINK=$BASE/gnatlink --GCC="$GCC" $gnatflags $gccflags $* -largs $EXTERNAL_OBJECTS --GCC="$GCC"
|
|
64 $BASE/gnatmake --GNATBIND=$BASE/gnatbind --GNATLINK=$BASE/gnatlink --GCC="$GCC" $gnatflags $gccflags $* -largs $EXTERNAL_OBJECTS --GCC="$GCC"
|
|
65 }
|
|
66
|
|
67 target_gcc () {
|
|
68 $GCC $gccflags $*
|
|
69 }
|
|
70
|
|
71 target_run () {
|
|
72 eval $EXPECT -f $testdir/run_test.exp $*
|
|
73 }
|
|
74
|
|
75 clean_dir () {
|
|
76 rm -f "$binmain" *.o *.ali > /dev/null 2>&1
|
|
77 }
|
|
78
|
|
79 find_main () {
|
|
80 ls ${i}?.adb > ${i}.lst 2> /dev/null
|
|
81 ls ${i}*m.adb >> ${i}.lst 2> /dev/null
|
|
82 ls ${i}.adb >> ${i}.lst 2> /dev/null
|
|
83 main=`tail -1 ${i}.lst`
|
|
84 }
|
|
85
|
|
86 EXTERNAL_OBJECTS=""
|
|
87 # Global variable to communicate external objects to link with.
|
|
88
|
|
89 rm -f $dir/acats.sum $dir/acats.log
|
|
90
|
|
91 display "Test Run By $USER on `date`"
|
|
92
|
|
93 display " === acats configuration ==="
|
|
94
|
|
95 target=`$GCC -dumpmachine`
|
|
96
|
|
97 display target gcc is $GCC
|
|
98 display `$GCC -v 2>&1`
|
|
99 display host=`gcc -dumpmachine`
|
|
100 display target=$target
|
|
101 display `type gnatmake`
|
|
102 gnatls -v >> $dir/acats.log
|
|
103 display ""
|
|
104
|
|
105 if [ -n "$GCC_RUNTEST_PARALLELIZE_DIR" ]; then
|
|
106 dir_support=$dir/../acats/support
|
|
107
|
|
108 rm -rf $dir/run
|
|
109 mv $dir/tests $dir/tests.$$ 2> /dev/null
|
|
110 rm -rf $dir/tests.$$ &
|
|
111 mkdir -p $dir/run
|
|
112
|
|
113 cp -pr $dir/../acats/tests $dir/
|
|
114 else
|
|
115 dir_support=$dir/support
|
|
116
|
|
117 display " === acats support ==="
|
|
118 display_noeol "Generating support files..."
|
|
119
|
|
120 rm -rf $dir/support
|
|
121 mkdir -p $dir/support
|
|
122 cd $dir/support
|
|
123
|
|
124 cp $testdir/support/*.ada $testdir/support/*.a $testdir/support/*.tst $dir/support
|
|
125
|
|
126 # Find out the size in bit of an address on the target
|
|
127 target_gnatmake $testdir/support/impbit.adb >> $dir/acats.log 2>&1
|
|
128 if [ $? -ne 0 ]; then
|
|
129 display "**** Failed to compile impbit"
|
|
130 exit 1
|
|
131 fi
|
|
132 target_run $dir/support/impbit > $dir/support/impbit.out 2>&1
|
|
133 target_bit=`cat $dir/support/impbit.out`
|
|
134 echo target_bit="$target_bit" >> $dir/acats.log
|
|
135
|
|
136 # Find out a suitable asm statement
|
|
137 # Adapted from configure.ac gcc_cv_as_dwarf2_debug_line
|
|
138 case "$target" in
|
|
139 ia64*-*-* | s390*-*-*)
|
|
140 target_insn="nop 0"
|
|
141 ;;
|
|
142 mmix-*-*)
|
|
143 target_insn="swym 0"
|
|
144 ;;
|
|
145 *)
|
|
146 target_insn="nop"
|
|
147 ;;
|
|
148 esac
|
|
149 echo target_insn="$target_insn" >> $dir/acats.log
|
|
150
|
|
151 sed -e "s,ACATS4GNATDIR,$dir,g" \
|
|
152 < $testdir/support/impdef.a > $dir/support/impdef.a
|
|
153 sed -e "s,ACATS4GNATDIR,$dir,g" \
|
|
154 -e "s,ACATS4GNATBIT,$target_bit,g" \
|
|
155 -e "s,ACATS4GNATINSN,$target_insn,g" \
|
|
156 < $testdir/support/macro.dfs > $dir/support/MACRO.DFS
|
|
157 sed -e "s,ACATS4GNATDIR,$dir,g" \
|
|
158 < $testdir/support/tsttests.dat > $dir/support/TSTTESTS.DAT
|
|
159
|
|
160 cp $testdir/tests/cd/*.c $dir/support
|
|
161 cp $testdir/tests/cxb/*.c $dir/support
|
|
162 grep -v '^#' $testdir/norun.lst | sort > $dir/support/norun.lst
|
|
163
|
|
164 rm -rf $dir/run
|
|
165 mv $dir/tests $dir/tests.$$ 2> /dev/null
|
|
166 rm -rf $dir/tests.$$ &
|
|
167 mkdir -p $dir/run
|
|
168
|
|
169 cp -pr $testdir/tests $dir/
|
|
170
|
|
171 for i in $dir/support/*.ada $dir/support/*.a; do
|
|
172 host_gnatchop $i >> $dir/acats.log 2>&1
|
|
173 done
|
|
174
|
|
175 # These tools are used to preprocess some ACATS sources
|
|
176 # they need to be compiled native on the host.
|
|
177
|
|
178 host_gnatmake -q -gnatws macrosub.adb
|
|
179 if [ $? -ne 0 ]; then
|
|
180 display "**** Failed to compile macrosub"
|
|
181 exit 1
|
|
182 fi
|
|
183 ./macrosub > macrosub.out 2>&1
|
|
184
|
|
185 gcc -c cd300051.c
|
|
186 host_gnatmake -q -gnatws widechr.adb
|
|
187 if [ $? -ne 0 ]; then
|
|
188 display "**** Failed to compile widechr"
|
|
189 exit 1
|
|
190 fi
|
|
191 ./widechr > widechr.out 2>&1
|
|
192
|
|
193 rm -f $dir/support/macrosub
|
|
194 rm -f $dir/support/widechr
|
|
195 rm -f $dir/support/*.ali
|
|
196 rm -f $dir/support/*.o
|
|
197
|
|
198 display " done."
|
|
199
|
|
200 # From here, all compilations will be made by the target compiler
|
|
201
|
|
202 display_noeol "Compiling support files..."
|
|
203
|
|
204 target_gcc -c *.c
|
|
205 if [ $? -ne 0 ]; then
|
|
206 display "**** Failed to compile C code"
|
|
207 exit 1
|
|
208 fi
|
|
209
|
|
210 target_gnatchop *.adt >> $dir/acats.log 2>&1
|
|
211
|
|
212 target_gnatmake -c -gnato -gnatE *.ads >> $dir/acats.log 2>&1
|
|
213 target_gnatmake -c -gnato -gnatE *.adb >> $dir/acats.log 2>&1
|
|
214
|
|
215 display " done."
|
|
216 display ""
|
|
217
|
|
218 fi
|
|
219
|
|
220 display " === acats tests ==="
|
|
221
|
|
222 if [ $# -eq 0 ]; then
|
|
223 chapters=`cd $dir/tests; echo [a-z]*`
|
|
224 else
|
|
225 chapters=$*
|
|
226 fi
|
|
227
|
|
228 glob_countn=0
|
|
229 glob_countok=0
|
|
230 glob_countu=0
|
|
231 par_count=0
|
|
232 par_countm=0
|
|
233 par_last=
|
|
234
|
|
235 for chapter in $chapters; do
|
|
236 # Used to generate support once and finish after that.
|
|
237 [ "$chapter" = "NONE" ] && continue
|
|
238
|
|
239 display Running chapter $chapter ...
|
|
240
|
|
241 if [ ! -d $dir/tests/$chapter ]; then
|
|
242 display "*** CHAPTER $chapter does not exist, skipping."
|
|
243 display ""
|
|
244 continue
|
|
245 fi
|
|
246
|
|
247 cd $dir/tests/$chapter
|
|
248 ls *.a *.ada *.adt *.am *.dep 2> /dev/null | sed -e 's/\(.*\)\..*/\1/g' | \
|
|
249 cut -c1-7 | sort | uniq | comm -23 - $dir_support/norun.lst \
|
|
250 > $dir/tests/$chapter/${chapter}.lst
|
|
251 countn=`wc -l < $dir/tests/$chapter/${chapter}.lst`
|
|
252 as_fn_arith $glob_countn + $countn
|
|
253 glob_countn=$as_val
|
|
254 for i in `cat $dir/tests/$chapter/${chapter}.lst`; do
|
|
255
|
|
256 # If running multiple run_all.sh jobs in parallel, decide
|
|
257 # if we should run this test in the current instance.
|
|
258 if [ -n "$GCC_RUNTEST_PARALLELIZE_DIR" ]; then
|
|
259 case "$i" in
|
|
260 # Ugh, some tests have inter-test dependencies, those
|
|
261 # tests have to be scheduled on the same parallel instance
|
|
262 # as previous test.
|
|
263 ce2108f | ce2108h | ce3112d) ;;
|
|
264 # All others can be hopefully scheduled freely.
|
|
265 *)
|
|
266 as_fn_arith $par_countm + 1
|
|
267 par_countm=$as_val
|
|
268 [ $par_countm -eq 10 ] && par_countm=0
|
|
269 if [ $par_countm -eq 1 ]; then
|
|
270 as_fn_arith $par_count + 1
|
|
271 par_count=$as_val
|
|
272 if mkdir $GCC_RUNTEST_PARALLELIZE_DIR/$par_count 2>/dev/null; then
|
|
273 par_last=1
|
|
274 else
|
|
275 par_last=
|
|
276 fi
|
|
277 fi;;
|
|
278 esac
|
|
279 if [ -z "$par_last" ]; then
|
|
280 as_fn_arith $glob_countn - 1
|
|
281 glob_countn=$as_val
|
|
282 continue
|
|
283 fi
|
|
284 fi
|
|
285
|
|
286 extraflags="-gnat95"
|
|
287 grep $i $testdir/overflow.lst > /dev/null 2>&1
|
|
288 if [ $? -eq 0 ]; then
|
|
289 extraflags="$extraflags -gnato"
|
|
290 fi
|
|
291 grep $i $testdir/elabd.lst > /dev/null 2>&1
|
|
292 if [ $? -eq 0 ]; then
|
|
293 extraflags="$extraflags -gnatE"
|
|
294 fi
|
|
295 grep $i $testdir/floatstore.lst > /dev/null 2>&1
|
|
296 if [ $? -eq 0 ]; then
|
|
297 extraflags="$extraflags -ffloat-store"
|
|
298 fi
|
|
299 grep $i $testdir/stackcheck.lst > /dev/null 2>&1
|
|
300 if [ $? -eq 0 ]; then
|
|
301 extraflags="$extraflags -fstack-check"
|
|
302 fi
|
|
303 test=$dir/tests/$chapter/$i
|
|
304 mkdir $test && cd $test >> $dir/acats.log 2>&1
|
|
305
|
|
306 if [ $? -ne 0 ]; then
|
|
307 display "FAIL: $i"
|
|
308 failed="${failed}${i} "
|
|
309 clean_dir
|
|
310 continue
|
|
311 fi
|
|
312
|
|
313 target_gnatchop -c -w `ls ${test}*.a ${test}*.ada ${test}*.adt ${test}*.am ${test}*.dep 2> /dev/null` >> $dir/acats.log 2>&1
|
|
314 main=""
|
|
315 find_main
|
|
316 if [ -z "$main" ]; then
|
|
317 sync
|
|
318 find_main
|
|
319 fi
|
|
320 binmain=`echo $main | sed -e 's/\(.*\)\..*/\1/g'`
|
|
321 echo "BUILD $main" >> $dir/acats.log
|
|
322 EXTERNAL_OBJECTS=""
|
|
323 case $i in
|
|
324 cxb30*) EXTERNAL_OBJECTS="$dir_support/cxb30040.o $dir_support/cxb30060.o $dir_support/cxb30130.o $dir_support/cxb30131.o";;
|
|
325 ca1020e) rm -f ca1020e_func1.adb ca1020e_func2.adb ca1020e_proc1.adb ca1020e_proc2.adb > /dev/null 2>&1;;
|
|
326 ca14028) rm -f ca14028_func2.ads ca14028_func3.ads ca14028_proc1.ads ca14028_proc3.ads > /dev/null 2>&1;;
|
|
327 esac
|
|
328 if [ "$main" = "" ]; then
|
|
329 display "FAIL: $i"
|
|
330 failed="${failed}${i} "
|
|
331 clean_dir
|
|
332 continue
|
|
333 fi
|
|
334
|
|
335 target_gnatmake $extraflags -I$dir_support $main >> $dir/acats.log 2>&1
|
|
336 if [ $? -ne 0 ]; then
|
|
337 display "FAIL: $i"
|
|
338 failed="${failed}${i} "
|
|
339 clean_dir
|
|
340 continue
|
|
341 fi
|
|
342
|
|
343 echo "RUN $binmain" >> $dir/acats.log
|
|
344 cd $dir/run
|
|
345 if [ ! -x $dir/tests/$chapter/$i/$binmain ]; then
|
|
346 sync
|
|
347 fi
|
|
348 target_run $dir/tests/$chapter/$i/$binmain > $dir/tests/$chapter/$i/${i}.log 2>&1
|
|
349 cd $dir/tests/$chapter/$i
|
|
350 cat ${i}.log >> $dir/acats.log
|
|
351 egrep -e '(==== |\+\+\+\+ |\!\!\!\! )' ${i}.log > /dev/null 2>&1
|
|
352 if [ $? -ne 0 ]; then
|
|
353 grep 'tasking not implemented' ${i}.log > /dev/null 2>&1
|
|
354
|
|
355 if [ $? -ne 0 ]; then
|
|
356 display "FAIL: $i"
|
|
357 failed="${failed}${i} "
|
|
358 else
|
|
359 log "UNSUPPORTED: $i"
|
|
360 as_fn_arith $glob_countn - 1
|
|
361 glob_countn=$as_val
|
|
362 as_fn_arith $glob_countu + 1
|
|
363 glob_countu=$as_val
|
|
364 fi
|
|
365 else
|
|
366 log "PASS: $i"
|
|
367 as_fn_arith $glob_countok + 1
|
|
368 glob_countok=$as_val
|
|
369 fi
|
|
370 clean_dir
|
|
371 done
|
|
372 done
|
|
373
|
|
374 display " === acats Summary ==="
|
|
375 display "# of expected passes $glob_countok"
|
|
376 display "# of unexpected failures `expr $glob_countn - $glob_countok`"
|
|
377
|
|
378 if [ $glob_countu -ne 0 ]; then
|
|
379 display "# of unsupported tests $glob_countu"
|
|
380 fi
|
|
381
|
|
382 if [ $glob_countok -ne $glob_countn ]; then
|
|
383 display "*** FAILURES: $failed"
|
|
384 fi
|
|
385
|
|
386 display "$0 completed at `date`"
|
|
387
|
|
388 exit 0
|