1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
|
#!/bin/sh
# Run ACATS with the GNU Ada compiler
# The following functions are to be customized if you run in cross
# environment or want to change compilation flags. Note that for
# tests requiring checks not turned on by default, this script
# automatically adds the needed flags to pass (ie: -gnato or -gnatE).
# gccflags="-O3 -fomit-frame-pointer -funroll-all-loops -finline-functions"
# gnatflags="-gnatN"
gccflags="-O2"
gnatflags="-gnatws"
target_run () {
eval $EXPECT -f $testdir/run_test.exp $*
}
# End of customization section.
display_noeol () {
printf "$@"
printf "$@" >> $dir/acats.sum
printf "$@" >> $dir/acats.log
}
display () {
echo "$@"
echo "$@" >> $dir/acats.sum
echo "$@" >> $dir/acats.log
}
log () {
echo "$@" >> $dir/acats.sum
echo "$@" >> $dir/acats.log
}
dir=`${PWDCMD-pwd}`
if [ "$testdir" = "" ]; then
echo You must use make check or make check-ada
exit 1
fi
if [ "$dir" = "$testdir" ]; then
echo "error: srcdir must be different than objdir, exiting."
exit 1
fi
target_gnatchop () {
gnatchop --GCC="$GCC_DRIVER" $*
}
target_gnatmake () {
echo gnatmake --GCC=\"$GCC\" $gnatflags $gccflags $* -largs $EXTERNAL_OBJECTS --GCC=\"$GCC\"
gnatmake --GCC="$GCC" $gnatflags $gccflags $* -largs $EXTERNAL_OBJECTS --GCC="$GCC"
}
target_gcc () {
$GCC $gccflags $*
}
clean_dir () {
rm -f "$binmain" *.o *.ali > /dev/null 2>&1
}
find_main () {
ls ${i}?.adb > ${i}.lst 2> /dev/null
ls ${i}*m.adb >> ${i}.lst 2> /dev/null
ls ${i}.adb >> ${i}.lst 2> /dev/null
main=`tail -1 ${i}.lst`
}
EXTERNAL_OBJECTS=""
# Global variable to communicate external objects to link with.
rm -f $dir/acats.sum $dir/acats.log
display "Test Run By $USER on `date`"
display " === acats configuration ==="
target=`$GCC -dumpmachine`
display target gcc is $GCC
display `$GCC -v 2>&1`
display host=`gcc -dumpmachine`
display target=$target
display `type gnatmake`
gnatls -v >> $dir/acats.log
display ""
display " === acats support ==="
display_noeol "Generating support files..."
rm -rf $dir/support
mkdir -p $dir/support
cd $dir/support
cp $testdir/support/*.ada $testdir/support/*.a $testdir/support/*.tst $dir/support
# Find out the size in bit of an address on the target
target_gnatmake $testdir/support/impbit.adb >> $dir/acats.log 2>&1
target_run $dir/support/impbit > $dir/support/impbit.out 2>&1
target_bit=`cat $dir/support/impbit.out`
echo target_bit="$target_bit" >> $dir/acats.log
# Find out a suitable asm statement
# Adapted from configure.ac gcc_cv_as_dwarf2_debug_line
case "$target" in
ia64*-*-* | s390*-*-*)
target_insn="nop 0"
;;
mmix-*-*)
target_insn="swym 0"
;;
*)
target_insn="nop"
;;
esac
echo target_insn="$target_insn" >> $dir/acats.log
sed -e "s,ACATS4GNATDIR,$dir,g" \
< $testdir/support/impdef.a > $dir/support/impdef.a
sed -e "s,ACATS4GNATDIR,$dir,g" \
-e "s,ACATS4GNATBIT,$target_bit,g" \
-e "s,ACATS4GNATINSN,$target_insn,g" \
< $testdir/support/macro.dfs > $dir/support/MACRO.DFS
sed -e "s,ACATS4GNATDIR,$dir,g" \
< $testdir/support/tsttests.dat > $dir/support/TSTTESTS.DAT
cp $testdir/tests/cd/*.c $dir/support
cp $testdir/tests/cxb/*.c $dir/support
grep -v '^#' $testdir/norun.lst | sort > $dir/support/norun.lst
rm -rf $dir/run
mv $dir/tests $dir/tests.$$ 2> /dev/null
rm -rf $dir/tests.$$ &
mkdir -p $dir/run
cp -pr $testdir/tests $dir/
for i in $dir/support/*.ada $dir/support/*.a; do
host_gnatchop $i >> $dir/acats.log 2>&1
done
# These tools are used to preprocess some ACATS sources
# they need to be compiled native on the host.
host_gnatmake -q -gnatws macrosub.adb
if [ $? -ne 0 ]; then
display "**** Failed to compile macrosub"
exit 1
fi
./macrosub > macrosub.out 2>&1
gcc -c cd300051.c
host_gnatmake -q -gnatws widechr.adb
if [ $? -ne 0 ]; then
display "**** Failed to compile widechr"
exit 1
fi
./widechr > widechr.out 2>&1
rm -f $dir/support/macrosub
rm -f $dir/support/widechr
rm -f $dir/support/*.ali
rm -f $dir/support/*.o
display " done."
# From here, all compilations will be made by the target compiler
display_noeol "Compiling support files..."
target_gcc -c *.c
if [ $? -ne 0 ]; then
display "**** Failed to compile C code"
exit 1
fi
target_gnatchop *.adt >> $dir/acats.log 2>&1
target_gnatmake -c -gnato -gnatE *.ads >> $dir/acats.log 2>&1
target_gnatmake -c -gnato -gnatE *.adb >> $dir/acats.log 2>&1
display " done."
display ""
display " === acats tests ==="
if [ $# -eq 0 ]; then
chapters=`cd $dir/tests; echo [a-z]*`
else
chapters=$*
fi
glob_countn=0
glob_countok=0
glob_countu=0
for chapter in $chapters; do
display Running chapter $chapter ...
if [ ! -d $dir/tests/$chapter ]; then
display "*** CHAPTER $chapter does not exist, skipping."
display ""
continue
fi
cd $dir/tests/$chapter
ls *.a *.ada *.adt *.am *.dep 2> /dev/null | sed -e 's/\(.*\)\..*/\1/g' | \
cut -c1-7 | sort | uniq | comm -23 - $dir/support/norun.lst \
> $dir/tests/$chapter/${chapter}.lst
countn=`wc -l < $dir/tests/$chapter/${chapter}.lst`
glob_countn=`expr $glob_countn + $countn`
counti=0
for i in `cat $dir/tests/$chapter/${chapter}.lst`; do
counti=`expr $counti + 1`
extraflags=""
grep $i $testdir/overflow.lst > /dev/null 2>&1
if [ $? -eq 0 ]; then
extraflags="$extraflags -gnato"
fi
grep $i $testdir/elabd.lst > /dev/null 2>&1
if [ $? -eq 0 ]; then
extraflags="$extraflags -gnatE"
fi
grep $i $testdir/stackcheck.lst > /dev/null 2>&1
if [ $? -eq 0 ]; then
extraflags="$extraflags -fstack-check"
fi
grep $i $testdir/ada95.lst > /dev/null 2>&1
if [ $? -eq 0 ]; then
extraflags="$extraflags -gnat95"
fi
test=$dir/tests/$chapter/$i
mkdir $test && cd $test >> $dir/acats.log 2>&1
if [ $? -ne 0 ]; then
display "FAIL: $i"
failed="${failed}${i} "
clean_dir
continue
fi
target_gnatchop -c -w `ls ${test}*.a ${test}*.ada ${test}*.adt ${test}*.am ${test}*.dep 2> /dev/null` >> $dir/acats.log 2>&1
main=""
find_main
if [ -z "$main" ]; then
sync
find_main
fi
binmain=`echo $main | sed -e 's/\(.*\)\..*/\1/g'`
echo "BUILD $main" >> $dir/acats.log
EXTERNAL_OBJECTS=""
case $i in
cxb30*) EXTERNAL_OBJECTS="$dir/support/cxb30040.o $dir/support/cxb30060.o $dir/support/cxb30130.o $dir/support/cxb30131.o";;
ca1020e) rm -f ca1020e_func1.adb ca1020e_func2.adb ca1020e_proc1.adb ca1020e_proc2.adb > /dev/null 2>&1;;
ca14028) rm -f ca14028_func2.ads ca14028_func3.ads ca14028_proc1.ads ca14028_proc3.ads > /dev/null 2>&1;;
cxh1001) extraflags="-a -f"; echo "pragma Normalize_Scalars;" > gnat.adc
esac
if [ "$main" = "" ]; then
display "FAIL: $i"
failed="${failed}${i} "
clean_dir
continue
fi
target_gnatmake $extraflags -I$dir/support $main >> $dir/acats.log 2>&1
if [ $? -ne 0 ]; then
display "FAIL: $i"
failed="${failed}${i} "
clean_dir
continue
fi
echo "RUN $binmain" >> $dir/acats.log
cd $dir/run
if [ ! -x $dir/tests/$chapter/$i/$binmain ]; then
sync
fi
target_run $dir/tests/$chapter/$i/$binmain > $dir/tests/$chapter/$i/${i}.log 2>&1
cd $dir/tests/$chapter/$i
cat ${i}.log >> $dir/acats.log
egrep -e '(==== |\+\+\+\+ |\!\!\!\! )' ${i}.log > /dev/null 2>&1
if [ $? -ne 0 ]; then
grep 'tasking not implemented' ${i}.log > /dev/null 2>&1
if [ $? -ne 0 ]; then
display "FAIL: $i"
failed="${failed}${i} "
else
log "UNSUPPORTED: $i"
glob_countn=`expr $glob_countn - 1`
glob_countu=`expr $glob_countu + 1`
fi
else
log "PASS: $i"
glob_countok=`expr $glob_countok + 1`
fi
clean_dir
done
done
display " === acats Summary ==="
display "# of expected passes $glob_countok"
display "# of unexpected failures `expr $glob_countn - $glob_countok`"
if [ $glob_countu -ne 0 ]; then
display "# of unsupported tests $glob_countu"
fi
if [ $glob_countok -ne $glob_countn ]; then
display "*** FAILURES: $failed"
fi
display "$0 completed at `date`"
exit 0
|