OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [insight/] [dejagnu/] [runtest] - Blame information for rev 1765

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
#!/bin/sh
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 
7
#
8
 
9
#
10
# Get the execution path to this script and the current directory.
11
#
12
mypath=${0-.}
13
if expr ${mypath} : '.*/.*' > /dev/null
14
then
15
    :
16
else
17
    IFS="${IFS=         }"; save_ifs="$IFS"; IFS="${IFS}:"
18
    for dir in $PATH
19
    do
20
        test -z "$dir" && dir=.
21
        if test -x $dir/$mypath
22
        then
23
            mypath=$dir/$mypath
24
            break
25
        fi
26
    done
27
    IFS="$save_ifs"
28
fi
29
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
#
35
runtest=`echo ${mypath} | sed -e 's@^.*/@@'`
36
target=`echo $runtest | sed -e 's/-runtest$//'`
37
if [ "$target" != runtest ] ; then
38
    target="--target ${target}"
39
else
40
    target=""
41
fi
42
 
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
46
# built one, and then use one in the path.
47
#
48
if [ x"$EXPECT" != x ] ; then
49
  expectbin=$EXPECT
50
else
51
  if [ -x "$execpath/expect" ] ; then
52
    expectbin=$execpath/expect
53
  else
54
      expectbin=expect
55
    fi
56
fi
57
 
58
# just to be safe...
59
if [ -z "$expectbin" ]; then
60
  echo "ERROR: No expect shell found"
61
  exit 1
62
fi
63
 
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"
67
fi
68
 
69
#
70
# Extract a few options from the option list.
71
#
72
verbose=0
73
debug=""
74
for a in "$@" ; do
75
  case $a in
76
      -v|--v|-verb*|--verb*)    verbose=`expr $verbose + 1`;;
77
      -D0|--D0)       debug="-D 0" ;;
78
      -D1|--D1)       debug="-D 1" ;;
79
  esac
80
done
81
 
82
if expr $verbose \> 0 > /dev/null ; then
83
  echo Expect binary is $expectbin
84
fi
85
 
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
#
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.
102
    fi
103
    if [ -f $i/runtest.exp ] ; then
104
        runpath=$i
105
        if expr $verbose \> 0 > /dev/null ; then
106
            echo Using $i/runtest.exp as main test driver
107
        fi
108
    fi
109
done
110
# check for an environment variable
111
if [ x"$DEJAGNULIBS" != x ] ; then
112
    runpath=$DEJAGNULIBS
113
    if expr $verbose \> 0 > /dev/null ; then
114
        echo Using $DEJAGNULIBS/runtest.exp as main test driver
115
    fi
116
fi
117
if [ x"$runpath" = x ] ; then
118
    echo "ERROR: runtest.exp does not exist."
119
    exit 1
120
fi
121
 
122
exec $expectbin $debug -- $runpath/runtest.exp $target ${1+"$@"}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.