test_installed 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. #! /bin/sh
  2. # (C) 1998, 2000, 2002, 2003, 2007 Free Software Foundation
  3. # Originally by Alexandre Oliva <oliva@dcc.unicamp.br>
  4. # This script is Free Software, and it can be copied, distributed and
  5. # modified as defined in the GNU General Public License. A copy of
  6. # its license can be downloaded from http://www.gnu.org/copyleft/gpl.html
  7. # This scripts assumes it lives in the contrib directory of the GCC
  8. # source tree, so it will find the testsuite tree from its location.
  9. # If you move it elsewhere, or want to use another testsuite tree, you
  10. # can override the defaults with --srcdir=/some/dir/GCC or
  11. # --testsuite=/some/dir/GCC/gcc/testsuite. If you specify
  12. # --testsuite, --srcdir will be ignored; otherwise, `/gcc/testsuite'
  13. # will be appended to the srcdir.
  14. # You may specify where the binaries to be tested should be picked up
  15. # from. If you specify --prefix=/some/dir, gcc, g++ and gfortran will be
  16. # looked for at /some/dir/bin. Each one may be overridden by
  17. # specifying --with-gcc=/pathname/to/gcc, --with-g++=/pathname/to/g++
  18. # and --with-gfortran=/pathname/to/gfortran. If you specify --without-gcc,
  19. # --without-g++ or --without-gfortran, the test for the specified program
  20. # will be skipped. By default, gcc, g++ and gfortran will be searched in
  21. # the PATH.
  22. # An additional argument may specify --tmpdir=/some/dir; by default,
  23. # temporaries will be stored in the current directory, where the log
  24. # files will be stored.
  25. # The script will interpret arguments until it finds one it does not
  26. # understand. The remaining ones will be passed to `runtest'. A
  27. # double-dash can be used to explicitly separate the arguments to
  28. # `test_installed' from the ones to `runtest'.
  29. # This script should be run in an empty directory; it will refuse to
  30. # run if it finds a file named site.exp in the current directory.
  31. if test -f site.exp; then
  32. echo site.exp already exists >&2
  33. exit 1
  34. fi
  35. while true; do
  36. case "$1" in
  37. --with-testsuite=*) testsuite=`echo "$1" | sed 's/[^=]*=//'`; shift;;
  38. --srcdir=*) srcdir=`echo "$1" | sed 's/[^=]*=//'`; shift;;
  39. --prefix=*) prefix=`echo "$1" | sed 's/[^=]*=//'`; shift;;
  40. --with-gcc=*) GCC_UNDER_TEST=`echo "$1" | sed 's/[^=]*=//'`; shift;;
  41. --with-g++=*) GXX_UNDER_TEST=`echo "$1" | sed 's/[^=]*=//'`; shift;;
  42. --with-gfortran=*) GFORTRAN_UNDER_TEST=`echo "$1" | sed 's/[^=]*=//'`; shift;;
  43. --without-gcc) GCC_UNDER_TEST=no; shift;;
  44. --without-g++) GXX_UNDER_TEST=no; shift;;
  45. --without-gfortran) GFORTRAN_UNDER_TEST=no; shift;;
  46. --without-objc) OBJC_UNDER_TEST=no; shift;;
  47. --tmpdir=*) tmpdir=`echo "$1" | sed 's/[^=]*=//'`; shift;;
  48. --help) cat <<\EOF
  49. Runs the testsuite for an installed version of gcc/g++/gfortran/objc
  50. Copyright (C) 1998 Free Software Foundation
  51. by Alexandre Oliva <oliva@dcc.unicamp.br>
  52. Supported arguments:
  53. --help prints this page
  54. --with-testsuite=/some/dir/gcc/testsuite specify the testsuite directory
  55. --srcdir=/some/dir same as --with-testsuite=/some/dir/gcc/testsuite
  56. [deduced from shell-script pathname]
  57. --prefix=/some/dir use gcc, g++ and gfortran from /some/dir/bin [PATH]
  58. --with-gcc=/some/dir/bin/gcc use specified gcc program [gcc]
  59. --with-g++=/some/dir/bin/g++ use specified g++ program [g++]
  60. --with-gfortran=/some/dir/bin/gfortran use specified gfortran program [gfortran]
  61. --without-gcc do not run gcc testsuite
  62. --without-g++ do not run g++ testsuite
  63. --without-gfortran do not run gfortran testsuite
  64. --without-objc do not run objc testsuite
  65. --tmpdir=/some/dir create temporaries and leave failed programs
  66. at specified directory [.]
  67. -- end of argument list; following arguments are passed to runtest
  68. EOF
  69. exit
  70. ;;
  71. --) shift; break;;
  72. *) break;;
  73. esac
  74. done
  75. if test x"${testsuite+set}" != x"set" && test x"${srcdir+set}" != x"set"; then
  76. file=$0
  77. while [ -h $file ]; do
  78. file=`ls -l $file | sed s/'.* -> '//`
  79. done
  80. srcdir=`CDPATH=. && cd \`echo "$file" | sed 's,/*[^/]*$,,;s,^$,.,'\`/.. >/dev/null && ${PWDCMD-pwd}`
  81. fi
  82. cat >site.exp <<EOF
  83. set rootme "."
  84. set tmpdir "${tmpdir-`${PWDCMD-pwd}`}"
  85. set srcdir "${testsuite-${srcdir}/gcc/testsuite}"
  86. set CFLAGS ""
  87. set CXXFLAGS ""
  88. set GCC_UNDER_TEST "${GCC_UNDER_TEST-${prefix}${prefix+/bin/}gcc}"
  89. set GXX_UNDER_TEST "${GXX_UNDER_TEST-${prefix}${prefix+/bin/}g++}"
  90. set GFORTRAN_UNDER_TEST "${GFORTRAN_UNDER_TEST-${prefix}${prefix+/bin/}gfortran}"
  91. set OBJC_UNDER_TEST "${OBJC_UNDER_TEST-${prefix}${prefix+/bin/}gcc}"
  92. EOF
  93. test x"${GCC_UNDER_TEST}" = x"no" || runtest --tool gcc ${1+"$@"}
  94. test x"${GXX_UNDER_TEST}" = x"no" || runtest --tool g++ ${1+"$@"}
  95. test x"${GFORTRAN_UNDER_TEST}" = x"no" || runtest --tool gfortran ${1+"$@"}
  96. test x"${OBJC_UNDER_TEST}" = x"no" || runtest --tool objc ${1+"$@"}
  97. exit 0