blob: a80d1ea3df6e58f7e8914aecab6ea042c0d4dab7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
#!/bin/sh
#
# runtest -- basically all this script does is find the proper expect shell
# and then
# run BlueGnu. <neurdenburgj@acm.org>
#
#
# Get the execution path to this script and the current directory.
#
execpath=`echo ${0-.} | sed -e 's@/[^/]*$@@'`
# rootme=`pwd`
#
# get the name by which bluegnu was invoked and extract the config triplet
#
bluegnu=`echo ${0-.} | sed -e 's@^.*/@@'`
target=`echo $bluegnu | sed -e 's/-runtest$//'`
if [ "$target" != runtest ] ; then
target="--target ${target}"
else
target=""
fi
#
# Find the right expect binary to use. If a variable EXPECT exists,
# it takes precedence over all other tests. Otherwise look for a freshly
# built one, and then use one in the path.
#
if [ x"$EXPECT" != x ] ; then
expectbin=$EXPECT
else
if [ -x "$execpath/expect" ] ; then
expectbin=$execpath/expect
else
expectbin=expect
fi
fi
# just to be safe...
if [ -z "$expectbin" ]; then
echo "ERROR: No expect shell found"
exit 1
fi
#
# Extract a few options from the option list.
#
verbose=0
debug=""
for a in "$@" ; do
case $a in
-v|--v|-verb*|--verb*) verbose=`expr $verbose + 1`;;
-D0|--D0) debug="-D 0" ;;
-D1|--D1) debug="-D 1" ;;
esac
done
if expr $verbose \> 0 > /dev/null ; then
echo Expect binary is $expectbin
fi
#
# find runtest.exp. First we look in it's installed location, otherwise
# start if from the source tree.
#
for i in $execpath/../lib/bluegnu $execpath ; do
if expr $verbose \> 1 > /dev/null ; then
echo Looking for $i/runtest.exp.
fi
if [ -f $i/runtest.exp ] ; then
runpath=$i
if expr $verbose \> 0 > /dev/null ; then
echo Using $i/runtest.exp as main test driver
fi
fi
done
# check for an environment variable
if [ x"$BLUEGNULIBS" != x ] ; then
runpath=$BLUEGNULIBS
if expr $verbose \> 0 > /dev/null ; then
echo Using $BLUEGNULIBS/runtest.exp as main test driver
fi
fi
if [ x"$runpath" = x ] ; then
echo "ERROR: runtest.exp does not exist."
exit 1
fi
exec $expectbin $debug -- $runpath/runtest.exp $target ${1+"$@"}
|