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