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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [contrib/] [regression/] [btest-gcc.sh] - Blame information for rev 297

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

Line No. Rev Author Line
1 265 jeremybenn
#!/bin/sh
2
 
3
#  Test GCC.
4
#  Copyright (C) 1999, 2000, 2001, 2002, 2005, 2006, 2009
5
#  Free Software Foundation, Inc.
6
 
7
#  This program is free software; you can redistribute it and/or modify
8
#  it under the terms of the GNU General Public License as published by
9
#  the Free Software Foundation; either version 3 of the License, or
10
#  (at your option) any later version.
11
 
12
#  This program is distributed in the hope that it will be useful,
13
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
#  GNU General Public License for more details.
16
 
17
#  You should have received a copy of the GNU General Public License
18
#  along with this program; see the file COPYING3.  If not see
19
#  <http://www.gnu.org/licenses/>.
20
 
21
# INPUT:
22
# btest <options> <target> <source> <prefix> <state> <build>
23
 
24
add_passes_despite_regression=0
25
dashj=''
26
 
27
# <options> can be
28
# --add-passes-despite-regression:
29
#  Add new "PASSes" despite there being some regressions.
30
# -j<n>:
31
#  Pass '-j<n>' to make.
32
 
33
case "$1" in
34
 --add-passes-despite-regression)
35
  add_passes_despite_regression=1; shift;;
36
 -j*)
37
  dashj=$1; shift;;
38
 -*) echo "Invalid option: $1"; exit 2;;
39
esac
40
 
41
# TARGET is the target triplet.  It should be the same one as used in
42
# constructing PREFIX.  Or it can be the keyword 'native', indicating
43
# a target of whatever platform the script is running on.
44
TARGET=$1
45
# SOURCE is the directory containing the toplevel configure.
46
SOURCE=$2
47
 
48
# PREFIX is the directory for the --prefix option to configure.
49
#   For cross compilers, it needs to contain header files,
50
#   libraries, and binutils.  PATH should probably include
51
#   $PREFIX/bin.
52
PREFIX=$3
53
# This script also needs to include the GDB testsuite in
54
#   $PREFIX/share/gdb-testsuite.
55
GDB_TESTSUITE=$PREFIX/share/gdb-testsuite
56
 
57
# STATE is where the tester maintains its internal state,
58
#   described below.
59
STATE=$4
60
 
61
# BUILD is a temporary directory that this script will
62
#   delete and recreate, containing the build tree.
63
BUILD=$5
64
 
65
# you also probably need to set these variables:
66
# PATH: should contain a native gcc, and a cross gdb.
67
# DEJAGNU: should point to a site.exp suitable for testing
68
#   the compiler and debugger.
69
 
70
 
71
# OUTPUT: in $RESULT, one of the following keywords:
72
#   error       the script failed due to
73
#               a misconfiguration or resource limitation
74
#   build       the build failed
75
#   regress-<n> the build succeeded, but there were <n>
76
#               testsuite regressions, listed in $REGRESS
77
#   pass        build succeeded and there were no regressions
78
RESULT=$STATE/RESULT
79
# in BUILD_LOG, the output of the build
80
BUILD_LOG=$STATE/build_log
81
# in FAILED, a list of failing testcases
82
FAILED=$STATE/failed
83
# in PASSES, the list of testcases we expect to pass
84
PASSES=$STATE/passes
85
# in REGRESS, a list of testcases we expected to pass but that failed
86
REGRESS=$STATE/regress
87
 
88
# Make sure various files exist.
89
[ -d $STATE ] || mkdir $STATE
90
[ -f $PASSES ] || touch $PASSES
91
 
92
# These lines should stay in this order, because
93
# that way if something is badly wrong and $RESULT can't
94
# be modified then cron will mail the error message.
95
# The reverse order could lead to the testsuite claiming that
96
# everything always passes, without running any tests.
97
echo error > $RESULT || exit 1
98
exec > $BUILD_LOG 2>&1 || exit 1
99
 
100
set -x
101
 
102
# Nuke $BUILD and recreate it.
103
rm -rf $BUILD $REGRESS $FAILED
104
mkdir $BUILD || exit 1
105
cd $BUILD || exit 1
106
 
107
H_BUILD=`$SOURCE/config.guess || exit 1`
108
H_HOST=$H_BUILD
109
if [ $TARGET = native ] ; then
110
  H_TARGET=$H_HOST
111
else
112
  H_TARGET=$TARGET
113
fi
114
H_REAL_TARGET=`$SOURCE/config.sub $H_TARGET || exit 1`
115
 
116
# TESTLOGS is the list of dejagnu .sum files that the tester should
117
# look at.
118
TESTLOGS="gcc/testsuite/gcc/gcc.sum
119
gcc/testsuite/g++/g++.sum
120
gcc/testsuite/gfortran/gfortran.sum
121
gcc/testsuite/objc/objc.sum"
122
 
123
# Build.
124
echo build > $RESULT
125
if [ $H_HOST = $H_TARGET ] ; then
126
  $SOURCE/configure --prefix=$PREFIX --target=$H_TARGET || exit 1
127
  if ! make $dashj bootstrap ; then
128
    [ -s .bad_compare ] || exit 1
129
    cat .bad_compare >> $REGRESS || exit 1
130
    touch compare || exit 1   # Prevent the comparison from running again
131
    make $dashj all || exit 1
132
  fi
133
else
134
  withopt="--with-gnu-ld --with-gnu-as"
135
  case "$H_TARGET" in
136
    *-linux*) ;;
137
    *) withopt="$withopt --with-newlib";;
138
  esac
139
  $SOURCE/configure --prefix=$PREFIX --target=$H_TARGET $withopt || exit 1
140
  make $dashj || exit 1
141
fi
142
echo error > $RESULT || exit 1
143
 
144
# Test GCC against its internal testsuite.
145
make $dashj -k check
146
 
147
if [ -f $BUILD/$H_TARGET/libstdc++-v3/testsuite/libstdc++.sum ] ; then
148
  TESTLOGS="$TESTLOGS $H_TARGET/libstdc++-v3/testsuite/libstdc++.sum"
149
fi
150
 
151
if [ -f $BUILD/$H_TARGET/libffi/testsuite/libffi.sum ] ; then
152
  TESTLOGS="$TESTLOGS $H_TARGET/libffi/testsuite/libffi.sum"
153
fi
154
 
155
if [ -f $BUILD/$H_TARGET/libjava/testsuite/libjava.sum ] ; then
156
  TESTLOGS="$TESTLOGS $H_TARGET/libjava/testsuite/libjava.sum"
157
fi
158
 
159
if [ -f $BUILD/$H_TARGET/libgomp/testsuite/libgomp.sum ] ; then
160
  TESTLOGS="$TESTLOGS $H_TARGET/libgomp/testsuite/libgomp.sum"
161
fi
162
 
163
# Test the just-built GCC with the GDB testsuite.
164
if [ -d $GDB_TESTSUITE ] ; then
165
  mkdir test-gdb || exit 1
166
  cd $GDB_TESTSUITE || exit 1
167
  for i in gdb.* ; do
168
    if [ -d $i ] ; then
169
      mkdir $BUILD/test-gdb/$i
170
    fi
171
  done
172
  cd $BUILD/test-gdb || exit 1
173
  echo "set host_alias $H_HOST" > site.exp
174
  echo "set host_triplet $H_HOST" >> site.exp
175
  echo "set target_alias $H_TARGET" >> site.exp
176
  echo "set target_triplet $H_REAL_TARGET" >> site.exp
177
  echo "set build_alias $H_BUILD" >> site.exp
178
  echo "set build_triplet $H_BUILD" >> site.exp
179
  echo "set srcdir $GDB_TESTSUITE" >> site.exp
180
  runtest --tool gdb
181
  TESTLOGS="$TESTLOGS test-gdb/gdb.sum"
182
fi
183
 
184
# Sanity-check the testlogs.  They should contain at least one PASS.
185
cd $BUILD || exit 1
186
for LOG in $TESTLOGS ; do
187
  if ! grep ^PASS: $LOG > /dev/null ; then
188
    echo build > $RESULT
189
    exit 1
190
  fi
191
done
192
 
193
# Work out what failed
194
for LOG in $TESTLOGS ; do
195
  L=`basename $LOG`
196
  awk '/^FAIL: / { print "'$L'",$2; }' $LOG || exit 1
197
done | sort | uniq > $FAILED || exit 1
198
comm -12 $FAILED $PASSES >> $REGRESS || exit 1
199
NUMREGRESS=`wc -l < $REGRESS | tr -d ' '`
200
 
201
if [ $NUMREGRESS -eq 0 ] || [ $add_passes_despite_regression -ne 0 ] ; then
202
  # Update the state.
203
  for LOG in $TESTLOGS ; do
204
    L=`basename $LOG`
205
    awk '/^PASS: / { print "'$L'",$2; }' $LOG || exit 1
206
  done | sort | uniq | comm -23 - $FAILED > ${PASSES}~ || exit 1
207
  [ -s ${PASSES}~ ] || exit 1
208
  if [ $NUMREGRESS -ne 0 ] ; then
209
    # The way we keep track of new PASSes when in "regress-N" for
210
    # --add-passes-despite-regression, is to *add* them to previous
211
    # PASSes.  Just as without this option, we don't forget *any* PASS
212
    # lines, because besides the ones in $REGRESS that we definitely
213
    # don't want to lose, their removal or rename may have been a
214
    # mistake (as in, the cause of the "regress-N" state).  If they
215
    # come back, we then know they're regressions.
216
    cat ${PASSES}~ ${PASSES} | sort -u > ${PASSES}~~
217
    mv ${PASSES}~~ ${PASSES} || exit 1
218
    rm ${PASSES}~ || exit 1
219
  else
220
    # In contrast to the merging for "regress-N", we just overwrite
221
    # the known PASSes when in the "pass" state, so we get rid of
222
    # stale PASS lines for removed, moved or otherwise changed tests
223
    # which may be added back with a different meaning later on.
224
    mv ${PASSES}~ ${PASSES} || exit 1
225
  fi
226
fi
227
 
228
if [ $NUMREGRESS -ne 0 ] ; then
229
  echo regress-$NUMREGRESS > $RESULT
230
  exit 1
231
fi
232
 
233
echo pass > $RESULT
234
exit 0

powered by: WebSVN 2.1.0

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