objs-gcc.sh 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. #!/bin/sh
  2. # Build tools for testing GCC.
  3. # Copyright (C) 1999, 2000, 2001, 2002, 2009
  4. # Free Software Foundation, Inc.
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 3 of the License, or
  8. # (at your option) any later version.
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program; see the file COPYING3. If not see
  15. # <http://www.gnu.org/licenses/>.
  16. # INPUT:
  17. # btest <target> <source> <prefix> <state> <build>
  18. # TARGET is the target triplet. It should be the same one as used in
  19. # constructing PREFIX. Or it can be the keyword 'native', indicating
  20. # a target of whatever platform the script is running on.
  21. TARGET=$1
  22. # SOURCE is the directory containing the toplevel configure.
  23. SOURCE=$2
  24. # PREFIX is the directory for the --prefix option to configure.
  25. PREFIX=$3
  26. # STATE is where the tester maintains its internal state,
  27. # described below.
  28. STATE=$4
  29. # BUILD is a temporary directory that this script will
  30. # delete and recreate, containing the build tree.
  31. BUILD=$5
  32. # you also probably need to set these variables:
  33. # DEJAGNU: should point to a site.exp suitable for testing
  34. # the compiler and debugger.
  35. # OUTPUT: in $RESULT, one of the following keywords:
  36. # error the script failed due to
  37. # a misconfiguration or resource limitation
  38. # build the build failed
  39. # regress-<n> the build succeeded, but there were <n>
  40. # testsuite regressions, listed in $REGRESS
  41. # pass build succeeded and there were no regressions
  42. RESULT=$STATE/RESULT
  43. # in BUILD_LOG, the output of the build
  44. BUILD_LOG=$STATE/build_log
  45. # in FAILED, a list of failing testcases
  46. FAILED=$STATE/failed
  47. # in PASSES, the list of testcases we expect to pass
  48. PASSES=$STATE/passes
  49. # in REGRESS, a list of testcases we expected to pass but that failed
  50. REGRESS=$STATE/regress
  51. # Make sure various files exist.
  52. [ -d $STATE ] || mkdir $STATE
  53. [ -f $PASSES ] || touch $PASSES
  54. # These lines should stay in this order, because
  55. # that way if something is badly wrong and $RESULT can't
  56. # be modified then cron will mail the error message.
  57. # The reverse order could lead to the testsuite claiming that
  58. # everything always passes, without running any tests.
  59. echo error > $RESULT || exit 1
  60. exec > $BUILD_LOG 2>&1 || exit 1
  61. set -x
  62. # TESTLOGS is the list of dejagnu .sum files that the tester should
  63. # look at.
  64. TESTLOGS="test/gcc/gcc.sum
  65. test/g++/g++.sum"
  66. # Nuke $BUILD and recreate it.
  67. rm -rf $BUILD $REGRESS $FAILED
  68. mkdir $BUILD $BUILD/build $BUILD/objs || exit 1
  69. cd $BUILD || exit 1
  70. # This script used to use config.guess, but that is not how releng
  71. # determines hostnames.
  72. H_BUILD=`$SOURCE/config.guess || exit 1`
  73. H_HOST=$H_BUILD
  74. if [ $TARGET = native ] ; then
  75. H_TARGET=$H_HOST
  76. else
  77. H_TARGET=$TARGET
  78. fi
  79. H_REAL_TARGET=`$SOURCE/config.sub $H_TARGET || exit 1`
  80. H_REAL_BUILD=`$SOURCE/config.sub $H_BUILD || exit 1`
  81. H_REAL_HOST=`$SOURCE/config.sub $H_HOST || exit 1`
  82. # Build.
  83. echo build > $RESULT
  84. cd $BUILD/build || exit 1
  85. TMP_PREFIX=$BUILD/install
  86. $SOURCE/configure --prefix=$PREFIX --target=$H_TARGET || exit 1
  87. if [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-gnu ]
  88. then
  89. make all-gdb all-dejagnu all-ld || exit 1
  90. make install-gdb install-dejagnu install-ld || exit 1
  91. elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
  92. make bootstrap || exit 1
  93. make install || exit 1
  94. else
  95. make || exit 1
  96. make install || exit 1
  97. fi
  98. if [ -x $PREFIX/bin/$TARGET-gdb ] ; then
  99. mkdir -p $PREFIX/share/gdb-testsuite || exit 1
  100. cd $SOURCE/gdb/testsuite || exit 1
  101. find . -print | cpio -pdmu $PREFIX/share/gdb-testsuite || exit 1
  102. # selftest.exp requires keeping old sources around, which is impractical
  103. rm $PREFIX/share/gdb-testsuite/gdb.base/selftest.exp
  104. # these tests seem to be broken and randomly failing
  105. rm -r $PREFIX/share/gdb-testsuite/gdb.mi
  106. fi
  107. echo pass > $RESULT
  108. exit 0