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