home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-bin / bin / m68k-amigaos-runtest < prev    next >
Encoding:
Text File  |  1996-10-12  |  2.1 KB  |  92 lines

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