source: vendor/gcc/3.2.2/contrib/regression/btest-gcc.sh

Last change on this file was 2, checked in by bird, 23 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 5.1 KB
Line 
1#!/bin/sh
2
3# Test GCC.
4# Copyright (C) 1999, 2000, 2001, 2002 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
20# INPUT:
21# btest <target> <source> <prefix> <state> <build>
22# TARGET is the target triplet. It should be the same one
23# as used in constructing PREFIX.
24TARGET=$1
25# SOURCE is the directory containing the toplevel configure.
26SOURCE=$2
27
28# PREFIX is the directory for the --prefix option to configure.
29# For cross compilers, it needs to contain header files,
30# libraries, and binutils. PATH should probably include
31# $PREFIX/bin.
32PREFIX=$3
33# This script also needs to include the GDB testsuite in
34# $PREFIX/share/gdb-testsuite.
35GDB_TESTSUITE=$PREFIX/share/gdb-testsuite
36
37# STATE is where the tester maintains its internal state,
38# described below.
39STATE=$4
40
41# BUILD is a temporary directory that this script will
42# delete and recreate, containing the build tree.
43BUILD=$5
44
45# you also probably need to set these variables:
46# PATH: should contain a native gcc, and a cross gdb.
47# DEJAGNU: should point to a site.exp suitable for testing
48# the compiler and debugger.
49
50
51# OUTPUT: in $RESULT, one of the following keywords:
52# error the script failed due to
53# a misconfiguration or resource limitation
54# build the build failed
55# regress-<n> the build succeeded, but there were <n>
56# testsuite regressions, listed in $REGRESS
57# pass build succeeded and there were no regressions
58RESULT=$STATE/RESULT
59# in BUILD_LOG, the output of the build
60BUILD_LOG=$STATE/build_log
61# in FAILED, a list of failing testcases
62FAILED=$STATE/failed
63# in PASSES, the list of testcases we expect to pass
64PASSES=$STATE/passes
65# in REGRESS, a list of testcases we expected to pass but that failed
66REGRESS=$STATE/regress
67
68# Make sure various files exist.
69[ -d $STATE ] || mkdir $STATE
70[ -f $PASSES ] || touch $PASSES
71
72# These lines should stay in this order, because
73# that way if something is badly wrong and $RESULT can't
74# be modified then cron will mail the error message.
75# The reverse order could lead to the testsuite claiming that
76# everything always passes, without running any tests.
77echo error > $RESULT || exit 1
78exec > $BUILD_LOG 2>&1 || exit 1
79
80set -x
81
82# Nuke $BUILD and recreate it.
83rm -rf $BUILD $REGRESS $FAILED
84mkdir $BUILD || exit 1
85cd $BUILD || exit 1
86
87H_BUILD=`$SOURCE/config.guess || exit 1`
88H_HOST=$H_BUILD
89if [ $TARGET = native ] ; then
90 H_TARGET=$H_HOST
91else
92 H_TARGET=$TARGET
93fi
94H_REAL_TARGET=`$SOURCE/config.sub $H_TARGET || exit 1`
95
96# TESTLOGS is the list of dejagnu .sum files that the tester should
97# look at.
98TESTLOGS="gcc/testsuite/gcc.sum
99gcc/testsuite/g++.sum
100gcc/testsuite/g77.sum
101gcc/testsuite/objc.sum
102test-gdb/gdb.sum"
103# $H_TARGET/libstdc++-v3/testsuite/libstdc++-v3.sum
104
105# Build.
106echo build > $RESULT
107$SOURCE/configure --prefix=$PREFIX --target=$H_TARGET || exit 1
108if [ $H_HOST = $H_TARGET ] ; then
109 if ! make bootstrap ; then
110 [ -s gcc/.bad_compare ] || exit 1
111 cat gcc/.bad_compare >> $REGRESS || exit 1
112 make all || exit 1
113 fi
114else
115 make || exit 1
116fi
117echo error > $RESULT || exit 1
118
119# Test GCC against its internal testsuite.
120make -k check-gcc
121
122# Test libstd++-v3
123make check-target-libstdc++-v3
124
125# Test the just-built GCC with the GDB testsuite.
126mkdir test-gdb || exit 1
127cd $GDB_TESTSUITE || exit 1
128for i in gdb.* ; do
129 if [ -d $i ] ; then
130 mkdir $BUILD/test-gdb/$i
131 fi
132done
133cd $BUILD/test-gdb || exit 1
134echo "set host_alias $H_HOST" > site.exp
135echo "set host_triplet $H_HOST" >> site.exp
136echo "set target_alias $H_TARGET" >> site.exp
137echo "set target_triplet $H_REAL_TARGET" >> site.exp
138echo "set build_alias $H_BUILD" >> site.exp
139echo "set build_triplet $H_BUILD" >> site.exp
140echo "set srcdir $GDB_TESTSUITE" >> site.exp
141runtest --tool gdb
142
143# Sanity-check the testlogs. They should contain at least one PASS.
144cd $BUILD || exit 1
145for LOG in $TESTLOGS ; do
146 if ! grep ^PASS: $LOG > /dev/null ; then
147 echo build > $RESULT
148 exit 1
149 fi
150done
151
152# Work out what failed
153for LOG in $TESTLOGS ; do
154 L=`basename $LOG`
155 awk '/^FAIL: / { print "'$L'",$2; }' $LOG || exit 1
156done | sort | uniq > $FAILED || exit 1
157comm -12 $FAILED $PASSES >> $REGRESS || exit 1
158NUMREGRESS=`wc -l < $REGRESS | tr -d ' '`
159if [ $NUMREGRESS -ne 0 ] ; then
160 echo regress-$NUMREGRESS > $RESULT
161 exit 1
162fi
163
164# It passed. Update the state.
165for LOG in $TESTLOGS ; do
166 L=`basename $LOG`
167 awk '/^PASS: / { print "'$L'",$2; }' $LOG || exit 1
168done | sort | uniq | comm -23 - $FAILED > ${PASSES}~ || exit 1
169[ -s ${PASSES}~ ] || exit 1
170mv ${PASSES}~ ${PASSES} || exit 1
171echo pass > $RESULT
172exit 0
Note: See TracBrowser for help on using the repository browser.