Avoid an infinite loop when TestRunner.sh is run outside of the test dir.
authorReid Spencer <rspencer@reidspencer.com>
Fri, 18 May 2007 02:06:03 +0000 (02:06 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Fri, 18 May 2007 02:06:03 +0000 (02:06 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37201 91177308-0d34-0410-b5e6-96231b3b80d8

test/TestRunner.sh

index 63e4ea7d6be6800233f4a4227db116339aee6bc2..d93eda28aab0f4fde899e86894906a3790181f9f 100755 (executable)
 #
 TESTPATH=`pwd`
 SUBDIR=""
-while test `basename $TESTPATH` != "test" -a ! -z "$TESTPATH" ; do
-  tmp=`basename $TESTPATH`
-  SUBDIR="$tmp/$SUBDIR"
-  TESTPATH=`dirname $TESTPATH`
-done
+if test `dirname $1` == "." ; then
+  while test `basename $TESTPATH` != "test" -a ! -z "$TESTPATH" ; do
+    tmp=`basename $TESTPATH`
+    SUBDIR="$tmp/$SUBDIR"
+    TESTPATH=`dirname $TESTPATH`
+  done
+fi
 
 for TESTFILE in "$@" ; do 
   if test `dirname $TESTFILE` == . ; then