test_installed 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. --target=*) target=`echo "$1" | sed 's/[^=]*=//'`; shift;;
  40. --prefix=*) prefix=`echo "$1" | sed 's/[^=]*=//'`; shift;;
  41. --with-gcc=*) GCC_UNDER_TEST=`echo "$1" | sed 's/[^=]*=//'`; shift;;
  42. --with-g++=*) GXX_UNDER_TEST=`echo "$1" | sed 's/[^=]*=//'`; shift;;
  43. --with-gfortran=*) GFORTRAN_UNDER_TEST=`echo "$1" | sed 's/[^=]*=//'`; shift;;
  44. --without-gcc) GCC_UNDER_TEST=no; shift;;
  45. --without-g++) GXX_UNDER_TEST=no; shift;;
  46. --without-gfortran) GFORTRAN_UNDER_TEST=no; shift;;
  47. --without-objc) OBJC_UNDER_TEST=no; shift;;
  48. --tmpdir=*) tmpdir=`echo "$1" | sed 's/[^=]*=//'`; shift;;
  49. --help) cat <<\EOF
  50. Runs the testsuite for an installed version of gcc/g++/gfortran/objc
  51. Copyright (C) 1998 Free Software Foundation
  52. by Alexandre Oliva <oliva@dcc.unicamp.br>
  53. Supported arguments:
  54. --help prints this page
  55. --with-testsuite=/some/dir/gcc/testsuite specify the testsuite directory
  56. --srcdir=/some/dir same as --with-testsuite=/some/dir/gcc/testsuite
  57. [deduced from shell-script pathname]
  58. --target=triplet The target architecture of the compiler being
  59. tested if different than the host.
  60. --prefix=/some/dir use gcc, g++ and gfortran from /some/dir/bin [PATH]
  61. --with-gcc=/some/dir/bin/gcc use specified gcc program [gcc]
  62. --with-g++=/some/dir/bin/g++ use specified g++ program [g++]
  63. --with-gfortran=/some/dir/bin/gfortran use specified gfortran program [gfortran]
  64. --without-gcc do not run gcc testsuite
  65. --without-g++ do not run g++ testsuite
  66. --without-gfortran do not run gfortran testsuite
  67. --without-objc do not run objc testsuite
  68. --tmpdir=/some/dir create temporaries and leave failed programs
  69. at specified directory [.]
  70. -- end of argument list; following arguments are passed to runtest
  71. EOF
  72. exit
  73. ;;
  74. --) shift; break;;
  75. *) break;;
  76. esac
  77. done
  78. if test x"${testsuite+set}" != x"set" && test x"${srcdir+set}" != x"set"; then
  79. file=$0
  80. while [ -h $file ]; do
  81. file=`ls -l $file | sed s/'.* -> '//`
  82. done
  83. srcdir=`CDPATH=. && cd \`echo "$file" | sed 's,/*[^/]*$,,;s,^$,.,'\`/.. >/dev/null && ${PWDCMD-pwd}`
  84. fi
  85. cat >site.exp <<EOF
  86. set rootme "."
  87. set tmpdir "${tmpdir-`${PWDCMD-pwd}`}"
  88. set srcdir "${testsuite-${srcdir}/gcc/testsuite}"
  89. set CFLAGS ""
  90. set CXXFLAGS ""
  91. set GCC_UNDER_TEST "${GCC_UNDER_TEST-${prefix}${prefix+/bin/}gcc}"
  92. set GXX_UNDER_TEST "${GXX_UNDER_TEST-${prefix}${prefix+/bin/}g++}"
  93. set GFORTRAN_UNDER_TEST "${GFORTRAN_UNDER_TEST-${prefix}${prefix+/bin/}gfortran}"
  94. set OBJC_UNDER_TEST "${OBJC_UNDER_TEST-${prefix}${prefix+/bin/}gcc}"
  95. EOF
  96. if test x${target} != x; then
  97. echo "set target_triplet $target" >> site.exp
  98. echo "set target_alias $target" >> site.exp
  99. fi
  100. test x"${GCC_UNDER_TEST}" = x"no" || runtest --tool gcc ${1+"$@"}
  101. test x"${GXX_UNDER_TEST}" = x"no" || runtest --tool g++ ${1+"$@"}
  102. test x"${GFORTRAN_UNDER_TEST}" = x"no" || runtest --tool gfortran ${1+"$@"}
  103. test x"${OBJC_UNDER_TEST}" = x"no" || runtest --tool objc ${1+"$@"}
  104. exit 0