4 # Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
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.
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.
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
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.
25 # SOURCE is the directory containing the toplevel configure.
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
33 # This script also needs to include the GDB testsuite in
34 # $PREFIX/share/gdb-testsuite.
35 GDB_TESTSUITE
=$PREFIX/share
/gdb-testsuite
37 # STATE is where the tester maintains its internal state,
41 # BUILD is a temporary directory that this script will
42 # delete and recreate, containing the build tree.
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.
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
59 # in BUILD_LOG, the output of the build
60 BUILD_LOG
=$STATE/build_log
61 # in FAILED, a list of failing testcases
63 # in PASSES, the list of testcases we expect to pass
65 # in REGRESS, a list of testcases we expected to pass but that failed
66 REGRESS
=$STATE/regress
68 # Make sure various files exist.
69 [ -d $STATE ] || mkdir
$STATE
70 [ -f $PASSES ] ||
touch $PASSES
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.
77 echo error
> $RESULT ||
exit 1
78 exec > $BUILD_LOG 2>&1 ||
exit 1
82 # Nuke $BUILD and recreate it.
83 rm -rf $BUILD $REGRESS $FAILED
84 mkdir
$BUILD ||
exit 1
87 H_BUILD
=`$SOURCE/config.guess || exit 1`
89 if [ $TARGET = native
] ; then
94 H_REAL_TARGET
=`$SOURCE/config.sub $H_TARGET || exit 1`
96 # TESTLOGS is the list of dejagnu .sum files that the tester should
98 TESTLOGS
="gcc/testsuite/gcc.sum
100 gcc/testsuite/g77.sum
101 gcc/testsuite/objc.sum
103 # $H_TARGET/libstdc++-v3/testsuite/libstdc++-v3.sum
107 $SOURCE/configure
--prefix=$PREFIX --target=$H_TARGET ||
exit 1
108 if [ $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
117 echo error
> $RESULT ||
exit 1
119 # Test GCC against its internal testsuite.
123 make check-target-libstdc
++-v3
125 # Test the just-built GCC with the GDB testsuite.
126 mkdir test-gdb ||
exit 1
127 cd $GDB_TESTSUITE ||
exit 1
130 mkdir
$BUILD/test-gdb
/$i
133 cd $BUILD/test-gdb ||
exit 1
134 echo "set host_alias $H_HOST" > site.exp
135 echo "set host_triplet $H_HOST" >> site.exp
136 echo "set target_alias $H_TARGET" >> site.exp
137 echo "set target_triplet $H_REAL_TARGET" >> site.exp
138 echo "set build_alias $H_BUILD" >> site.exp
139 echo "set build_triplet $H_BUILD" >> site.exp
140 echo "set srcdir $GDB_TESTSUITE" >> site.exp
143 # Sanity-check the testlogs. They should contain at least one PASS.
145 for LOG
in $TESTLOGS ; do
146 if ! grep ^PASS
: $LOG > /dev
/null
; then
152 # Work out what failed
153 for LOG
in $TESTLOGS ; do
155 awk '/^FAIL: / { print "'$L'",$2; }' $LOG ||
exit 1
156 done |
sort |
uniq > $FAILED ||
exit 1
157 comm -12 $FAILED $PASSES >> $REGRESS ||
exit 1
158 NUMREGRESS
=`wc -l < $REGRESS | tr -d ' '`
159 if [ $NUMREGRESS -ne 0 ] ; then
160 echo regress-
$NUMREGRESS > $RESULT
164 # It passed. Update the state.
165 for LOG
in $TESTLOGS ; do
167 awk '/^PASS: / { print "'$L'",$2; }' $LOG ||
exit 1
168 done |
sort |
uniq |
comm -23 - $FAILED > ${PASSES}~ ||
exit 1
169 [ -s ${PASSES}~
] ||
exit 1
170 mv ${PASSES}~
${PASSES} ||
exit 1