OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [ada/] [acats/] [run_all.sh] - Blame information for rev 856

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
#!/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
target_run () {
16
$*
17
}
18
 
19
# End of customization section.
20
 
21
display_noeol () {
22
  printf "$@"
23
  printf "$@" >> $dir/acats.sum
24
  printf "$@" >> $dir/acats.log
25
}
26
 
27
display () {
28
  echo "$@"
29
  echo "$@" >> $dir/acats.sum
30
  echo "$@" >> $dir/acats.log
31
}
32
 
33
log () {
34
  echo "$@" >> $dir/acats.sum
35
  echo "$@" >> $dir/acats.log
36
}
37
 
38
dir=`${PWDCMD-pwd}`
39
 
40
if [ "$testdir" = "" ]; then
41
   echo You must use make check or make check-ada
42
   exit 1
43
fi
44
 
45
if [ "$dir" = "$testdir" ]; then
46
  echo "error: srcdir must be different than objdir, exiting."
47
  exit 1
48
fi
49
 
50
target_gnatchop () {
51
  gnatchop --GCC="$GCC_DRIVER" $*
52
}
53
 
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"
57
}
58
 
59
target_gcc () {
60
  $GCC $gccflags $*
61
}
62
 
63
clean_dir () {
64
  rm -f "$binmain" *.o *.ali > /dev/null 2>&1
65
}
66
 
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`
72
}
73
 
74
EXTERNAL_OBJECTS=""
75
# Global variable to communicate external objects to link with.
76
 
77
rm -f $dir/acats.sum $dir/acats.log
78
 
79
display "               === acats configuration ==="
80
 
81
target=`$GCC -dumpmachine`
82
 
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 ""
90
 
91
display "               === acats support ==="
92
display_noeol "Generating support files..."
93
 
94
rm -rf $dir/support
95
mkdir -p $dir/support
96
cd $dir/support
97
 
98
cp $testdir/support/*.ada $testdir/support/*.a $testdir/support/*.tst $dir/support
99
 
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
105
 
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"
111
    ;;
112
  mmix-*-*)
113
    target_insn="swym 0"
114
    ;;
115
  *)
116
    target_insn="nop"
117
    ;;
118
esac
119
echo target_insn="$target_insn" >> $dir/acats.log
120
 
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
129
 
130
cp $testdir/tests/cd/*.c $dir/support
131
cp $testdir/tests/cxb/*.c $dir/support
132
 
133
rm -rf $dir/run
134
mv $dir/tests $dir/tests.$$ 2> /dev/null
135
rm -rf $dir/tests.$$ &
136
mkdir -p $dir/run
137
 
138
cp -pr $testdir/tests $dir/
139
 
140
for i in $dir/support/*.ada $dir/support/*.a; do
141
   host_gnatchop $i >> $dir/acats.log 2>&1
142
done
143
 
144
# These tools are used to preprocess some ACATS sources
145
# they need to be compiled native on the host.
146
 
147
host_gnatmake -q -gnatws macrosub.adb
148
if [ $? -ne 0 ]; then
149
   display "**** Failed to compile macrosub"
150
   exit 1
151
fi
152
./macrosub > macrosub.out 2>&1
153
 
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
159
fi
160
./widechr > widechr.out 2>&1
161
 
162
rm -f $dir/support/macrosub
163
rm -f $dir/support/widechr
164
rm -f $dir/support/*.ali
165
rm -f $dir/support/*.o
166
 
167
display " done."
168
 
169
# From here, all compilations will be made by the target compiler
170
 
171
display_noeol "Compiling support files..."
172
 
173
target_gcc -c *.c
174
if [ $? -ne 0 ]; then
175
   display "**** Failed to compile C code"
176
   exit 1
177
fi
178
 
179
target_gnatchop *.adt >> $dir/acats.log 2>&1
180
 
181
target_gnatmake -c -gnato -gnatE *.ads >> $dir/acats.log 2>&1
182
target_gnatmake -c -gnato -gnatE *.adb >> $dir/acats.log 2>&1
183
 
184
display " done."
185
display ""
186
display "               === acats tests ==="
187
 
188
if [ $# -eq 0 ]; then
189
   chapters=`cd $dir/tests; echo [a-z]*`
190
else
191
   chapters=$*
192
fi
193
 
194
glob_countn=0
195
glob_countok=0
196
glob_countu=0
197
 
198
for chapter in $chapters; do
199
   display Running chapter $chapter ...
200
 
201
   if [ ! -d $dir/tests/$chapter ]; then
202
      display "*** CHAPTER $chapter does not exist, skipping."
203
      display ""
204
      continue
205
   fi
206
 
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"
220
      fi
221
      grep $i $testdir/elabd.lst > /dev/null 2>&1
222
      if [ $? -eq 0 ]; then
223
         extraflags="$extraflags -gnatE"
224
      fi
225
      grep $i $testdir/stackcheck.lst > /dev/null 2>&1
226
      if [ $? -eq 0 ]; then
227
         extraflags="$extraflags -fstack-check"
228
      fi
229
      grep $i $testdir/ada95.lst > /dev/null 2>&1
230
      if [ $? -eq 0 ]; then
231
         extraflags="$extraflags -gnat95"
232
      fi
233
      test=$dir/tests/$chapter/$i
234
      mkdir $test && cd $test >> $dir/acats.log 2>&1
235
 
236
      if [ $? -ne 0 ]; then
237
         display "FAIL: $i"
238
         failed="${failed}${i} "
239
         clean_dir
240
         continue
241
      fi
242
 
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
249
      fi
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
264
      fi
265
 
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
272
      fi
273
 
274
      echo "RUN $binmain" >> $dir/acats.log
275
      cd $dir/run
276
      if [ ! -x $dir/tests/$chapter/$i/$binmain ]; then
277
         sync
278
      fi
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
285
 
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`
293
         fi
294
      else
295
         log "PASS:     $i"
296
         glob_countok=`expr $glob_countok + 1`
297
      fi
298
      clean_dir
299
   done
300
done
301
 
302
display "               === acats Summary ==="
303
display "# of expected passes           $glob_countok"
304
display "# of unexpected failures       `expr $glob_countn - $glob_countok`"
305
 
306
if [ $glob_countu -ne 0 ]; then
307
   display "# of unsupported tests              $glob_countu"
308
fi
309
 
310
if [ $glob_countok -ne $glob_countn ]; then
311
   display "*** FAILURES: $failed"
312
fi
313
 
314
exit 0

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.