3 # runtest -- basically all this script does is find the proper expect
4 # shell and then run DejaGnu.
6 # Written by Rob Savoye <rob@welcomehome.org>
10 # Get the execution path to this script and the current directory.
13 if expr ${mypath} : '.*/.*' > /dev
/null
17 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
="${IFS}:"
20 test -z "$dir" && dir
=.
21 if test -x $dir/$mypath
29 execpath
=`echo ${mypath} | sed -e 's@/[^/]*$@@'`
33 # get the name by which runtest was invoked and extract the config triplet
35 runtest
=`echo ${mypath} | sed -e 's@^.*/@@'`
36 target
=`echo $runtest | sed -e 's/-runtest$//'`
37 if [ "$target" != runtest
] ; then
38 target
="--target ${target}"
44 # Find the right expect binary to use. If a variable EXPECT exists,
45 # it takes precedence over all other tests. Otherwise look for a freshly
46 # built one, and then use one in the path.
48 if [ x
"$EXPECT" != x
] ; then
51 if [ -x "$execpath/expect" ] ; then
52 expectbin
=$execpath/expect
59 if [ -z "$expectbin" ]; then
60 echo "ERROR: No expect shell found"
64 # This wrapper script will set up run-time library search PATHs
65 if [ -x "$expectbin-bld.sh" ]; then
66 expectbin
="${CONFIG_SHELL-/bin/sh} $expectbin-bld.sh"
70 # Extract a few options from the option list.
76 -v|
--v|
-verb*|
--verb*) verbose
=`expr $verbose + 1`;;
77 -D0|
--D0) debug
="-D 0" ;;
78 -D1|
--D1) debug
="-D 1" ;;
82 if expr $verbose \
> 0 > /dev
/null
; then
83 echo Expect binary is
$expectbin
87 # find runtest.exp. First we look in it's installed location, otherwise
88 # start if from the source tree.
90 # runtest.exp is found in (autoconf-configure-set) @datadir@, but
91 # $execpath is @bindir@. We're assuming that
93 # @datadir@ == @bindir@/../share
95 # @datadir@ == @bindir@/../../share
97 # which is a very weak assumption
99 for i
in `echo ${execpath} | sed -e 's@/[^/]*$@/share/dejagnu@'` `echo ${execpath} | sed -e 's@/[^/]*/[^/]*$@/share/dejagnu@'` $execpath ; do
100 if expr $verbose \
> 1 > /dev
/null
; then
101 echo Looking
for $i/runtest.exp.
103 if [ -f $i/runtest.exp
] ; then
105 if expr $verbose \
> 0 > /dev
/null
; then
106 echo Using
$i/runtest.exp as main
test driver
111 # check for an environment variable
112 if [ x
"$DEJAGNULIBS" != x
] ; then
114 if expr $verbose \
> 0 > /dev
/null
; then
115 echo Using
$DEJAGNULIBS/runtest.exp as main
test driver
118 if [ x
"$runpath" = x
] ; then
119 echo "ERROR: runtest.exp does not exist."
123 exec $expectbin $debug -- $runpath/runtest.exp
$target ${1+"$@"}