OSDN Git Service

5171b2ef775f35be50745af0ff6b2abb9e9a0634
[pf3gnuchains/gcc-fork.git] / contrib / regression / objs-gcc.sh
1 #!/bin/sh
2
3 #  Build tools for testing 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.
24 TARGET=$1
25 # SOURCE is the directory containing the toplevel configure.
26 SOURCE=$2
27
28 # PREFIX is the directory for the --prefix option to configure.
29 PREFIX=$3
30
31 # STATE is where the tester maintains its internal state,
32 #   described below.
33 STATE=$4
34
35 # BUILD is a temporary directory that this script will
36 #   delete and recreate, containing the build tree.
37 BUILD=$5
38
39 # you also probably need to set these variables:
40 # DEJAGNU: should point to a site.exp suitable for testing
41 #   the compiler and debugger.
42
43 # OUTPUT: in $RESULT, one of the following keywords:
44 #   error       the script failed due to
45 #               a misconfiguration or resource limitation
46 #   build       the build failed
47 #   regress-<n> the build succeeded, but there were <n>
48 #               testsuite regressions, listed in $REGRESS
49 #   pass        build succeeded and there were no regressions
50 RESULT=$STATE/RESULT
51 # in BUILD_LOG, the output of the build
52 BUILD_LOG=$STATE/build_log
53 # in FAILED, a list of failing testcases
54 FAILED=$STATE/failed
55 # in PASSES, the list of testcases we expect to pass
56 PASSES=$STATE/passes
57 # in REGRESS, a list of testcases we expected to pass but that failed
58 REGRESS=$STATE/regress
59
60 # Make sure various files exist.
61 [ -d $STATE ] || mkdir $STATE
62 [ -f $PASSES ] || touch $PASSES
63
64 # These lines should stay in this order, because
65 # that way if something is badly wrong and $RESULT can't
66 # be modified then cron will mail the error message.
67 # The reverse order could lead to the testsuite claiming that
68 # everything always passes, without running any tests.
69 echo error > $RESULT || exit 1
70 exec > $BUILD_LOG 2>&1 || exit 1
71
72 set -x
73
74 # TESTLOGS is the list of dejagnu .sum files that the tester should
75 # look at.
76 TESTLOGS="test/gcc/gcc.sum
77 test/g++/g++.sum"
78
79 # Nuke $BUILD and recreate it.
80 rm -rf $BUILD $REGRESS $FAILED
81 mkdir $BUILD $BUILD/build $BUILD/objs || exit 1
82 cd $BUILD || exit 1
83
84 # This script used to use config.guess, but that is not how releng
85 # determines hostnames.
86 H_BUILD=`$SOURCE/config.guess || exit 1`
87 H_HOST=$H_BUILD
88 if [ $TARGET = native ] ; then
89   H_TARGET=$H_HOST
90 else
91   H_TARGET=$TARGET
92 fi
93 H_REAL_TARGET=`$SOURCE/config.sub $H_TARGET || exit 1`
94 H_REAL_BUILD=`$SOURCE/config.sub $H_BUILD || exit 1`
95 H_REAL_HOST=`$SOURCE/config.sub $H_HOST || exit 1`
96
97 # Build.
98 echo build > $RESULT
99
100 cd $BUILD/build || exit 1
101 TMP_PREFIX=$BUILD/install
102 $SOURCE/configure --prefix=$PREFIX --target=$H_TARGET || exit 1
103 if [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-gnu ]
104  then
105   make all-gdb all-dejagnu all-ld || exit 1
106   make install-gdb install-dejagnu install-ld || exit 1
107 elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
108   make bootstrap || exit 1
109   make install || exit 1
110 else
111   make || exit 1
112   make install || exit 1
113 fi
114
115 mkdir -p $PREFIX/share/gdb-testsuite || exit 1
116 cd $SOURCE/gdb/testsuite || exit 1
117 find . -print | cpio -pdmu $PREFIX/share/gdb-testsuite || exit 1
118 # selftest.exp requires keeping old sources around, which is impractical
119 rm $PREFIX/share/gdb-testsuite/gdb.base/selftest.exp
120 # these tests seem to be broken and randomly failing
121 rm -r $PREFIX/share/gdb-testsuite/gdb.mi
122
123 echo pass > $RESULT
124 exit 0