~ubuntu-branches/ubuntu/oneiric/dejagnu/oneiric

« back to all changes in this revision

Viewing changes to runtest

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Jacobowitz
  • Date: 2006-12-11 09:06:59 UTC
  • mfrom: (2.1.6 edgy)
  • Revision ID: james.westby@ubuntu.com-20061211090659-w586kgi3giz84053
Tags: 1.4.4.cvs20060709-3
* Acknowledge previous NMUs.
* Fix permissions on /usr/share/dejagnu when building without fakeroot
  (Closes: #392589, #379809).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/sh
2
2
#
3
 
# runtest -- basically all this script does is find the proper expect
4
 
#            shell and then run DejaGnu.
5
 
#
6
 
# Written by Rob Savoye <rob@welcomehome.org>
7
 
#
8
 
 
9
 
#
 
3
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
 
4
# 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
 
5
#
 
6
# This file is part of DejaGnu.
 
7
#
 
8
# DejaGnu is free software; you can redistribute it and/or modify it
 
9
# under the terms of the GNU General Public License as published by
 
10
# the Free Software Foundation; either version 2 of the License, or
 
11
# (at your option) any later version.
 
12
#
 
13
# DejaGnu is distributed in the hope that it will be useful, but
 
14
# WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
16
# General Public License for more details.
 
17
#
 
18
# You should have received a copy of the GNU General Public License
 
19
# along with DejaGnu; if not, write to the Free Software Foundation,
 
20
# Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
 
21
 
 
22
# This script was written by Rob Savoye. The script finds the proper
 
23
# expect shell and then starts DejaGnu.
 
24
 
10
25
# Get the execution path to this script and the current directory.
11
 
#
 
26
 
12
27
mypath=${0-.}
13
28
if expr ${mypath} : '.*/.*' > /dev/null
14
29
then
27
42
    IFS="$save_ifs"
28
43
fi
29
44
execpath=`echo ${mypath} | sed  -e 's@/[^/]*$@@'`
30
 
# rootme=`pwd`
31
 
 
32
 
#
33
 
# get the name by which runtest was invoked and extract the config triplet
34
 
#
 
45
 
 
46
# Get the name by which runtest was invoked and extract the config
 
47
# triplet.
 
48
 
35
49
runtest=`echo ${mypath} | sed -e 's@^.*/@@'`
36
50
target=`echo $runtest | sed -e 's/-runtest$//'`
37
51
if [ "$target" != runtest ] ; then
40
54
    target=""
41
55
fi
42
56
 
43
 
#
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
 
57
# Find the right expect binary to use. If a variable EXPECT exists, it
 
58
# takes precedence over all other tests. Otherwise look for a freshly
46
59
# built one, and then use one in the path.
47
 
#
 
60
 
48
61
if [ x"$EXPECT" != x ] ; then
49
62
  expectbin=$EXPECT
50
63
else
55
68
    fi
56
69
fi
57
70
 
58
 
# just to be safe...
 
71
# Just to be safe ..
 
72
 
59
73
if [ -z "$expectbin" ]; then
60
74
  echo "ERROR: No expect shell found"
61
75
  exit 1
62
76
fi
63
77
 
64
 
# This wrapper script will set up run-time library search PATHs
 
78
# This wrapper script will set up run-time library search PATHs.
 
79
 
65
80
if [ -x "$expectbin-bld.sh" ]; then
66
81
  expectbin="${CONFIG_SHELL-/bin/sh} $expectbin-bld.sh"
67
82
fi
68
83
 
69
 
#
70
84
# Extract a few options from the option list.
71
 
#
 
85
 
72
86
verbose=0
73
87
debug=""
74
88
for a in "$@" ; do
83
97
  echo Expect binary is $expectbin
84
98
fi
85
99
 
86
 
#
87
 
# find runtest.exp. First we look in it's installed location, otherwise
88
 
# start if from the source tree.
89
 
#
90
 
# runtest.exp is found in (autoconf-configure-set) @datadir@, but
91
 
# $execpath is @bindir@.  We're assuming that
92
 
#
93
 
# @datadir@ == @bindir@/../share
94
 
# or
95
 
# @datadir@ == @bindir@/../../share
96
 
#
97
 
# which is a very weak assumption
98
 
#
 
100
# Find runtest.exp. First we look in its installed location,
 
101
# otherwise start if from the source tree.
 
102
#
 
103
# runtest.exp is found in @datadir@ (set by configure), but $execpath
 
104
# is @bindir@.  We're assuming that:
 
105
#
 
106
#   @datadir@ == @bindir@/../share
 
107
#   or
 
108
#   @datadir@ == @bindir@/../../share
 
109
#
 
110
# .. which is a very weak assumption
 
111
 
99
112
for i in `echo ${execpath} | sed  -e 's@/[^/]*$@/share/dejagnu@'` `echo ${execpath} | sed  -e 's@/[^/]*/[^/]*$@/share/dejagnu@'` $execpath ; do
100
113
    if expr $verbose \> 1 > /dev/null ; then
101
114
        echo Looking for $i/runtest.exp.
108
121
        break;
109
122
    fi
110
123
done
111
 
# check for an environment variable
 
124
 
 
125
# Check for an environment variable.
 
126
 
112
127
if [ x"$DEJAGNULIBS" != x ] ; then
113
128
    runpath=$DEJAGNULIBS
114
129
    if expr $verbose \> 0 > /dev/null ; then
116
131
    fi
117
132
fi
118
133
if [ x"$runpath" = x ] ; then
119
 
    echo "ERROR: runtest.exp does not exist."
 
134
    echo "ERROR: runtest.exp does not exist"
 
135
    exit 1
 
136
fi
 
137
 
 
138
if ! type $expectbin >/dev/null 2>/dev/null ; then
 
139
    echo "ERROR: unable to find expect on the PATH"
120
140
    exit 1
121
141
fi
122
142