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