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