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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [contrib/] [regression/] [btest-gcc.sh] - Blame information for rev 855

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

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

powered by: WebSVN 2.1.0

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