dejagnu runtest and runtest.exp

Philippe De Muyter phdm@mail.macqel.be
Mon Oct 13 15:02:00 GMT 1997


> Philippe De Muyter just posted a patch
> (< 199710131730.TAA11370@mail.macqel.be >) which should fix that, but I
> think his patch should be changed to search PATH rather than to rely
> on the builtin ``type'' command.

OK, here it is.  With an example it is much easier :)
Note that I use test -x, not -f as in example Ian provided.  This should
perhaps be fixed in configure.

Mon Oct 13 19:15:41 1997  Philippe De Muyter  <phdm@macqel.be>

	* runtest (mypath): Scan $PATH to set mypath if $0 does not give it.

--- ./dejagnu/runtest	Mon Oct 13 22:45:59 1997
+++ ./dejagnu/runtest	Mon Oct 13 22:44:12 1997
@@ -7,13 +7,30 @@
 #
 # Get the execution path to this script and the current directory.
 #
-execpath=`echo ${0-.} | sed  -e 's@/[^/]*$@@'`
+mypath=${0-.}
+if expr ${mypath} : '.*/.*' > /dev/null
+then
+    :
+else
+    IFS="${IFS= 	}"; save_ifs="$IFS"; IFS="${IFS}:"
+    for dir in $PATH
+    do
+	test -z "$dir" && dir=.
+	if test -x $dir/$mypath
+	then
+	    mypath=$dir/$mypath
+	    break
+	fi
+    done
+    IFS="$save_ifs"
+fi
+execpath=`echo ${mypath} | sed  -e 's@/[^/]*$@@'`
 # rootme=`pwd`
 
 #
 # get the name by which runtest was invoked and extract the config triplet
 #
-runtest=`echo ${0-.} | sed -e 's@^.*/@@'`
+runtest=`echo ${mypath} | sed -e 's@^.*/@@'`
 target=`echo $runtest | sed -e 's/-runtest$//'`
 if [ "$target" != runtest ] ; then
     target="--target ${target}"



More information about the Gcc mailing list