Index: trunk/Ohana/src/opihi/test/tests.sh
===================================================================
--- trunk/Ohana/src/opihi/test/tests.sh	(revision 8173)
+++ trunk/Ohana/src/opihi/test/tests.sh	(revision 8297)
@@ -1,4 +1,11 @@
 
-$VERBOSE = 0
+if ($?VERBOSE == 0)
+ $VERBOSE = 0
+end
+
+$failtest:n = 0
+$failfile:n = 0
+$faildirs:n = 0
+$currentdir = .
 
 macro fulltests
@@ -16,34 +23,5 @@
        echo "directory $testdir:$Ti"
     end
-    list testscripts -x "ls $testdir:$Ti/*.sh"
-    for Tj 0 $testscripts:n
-      if ($VERBOSE > 1)
-         echo " running $testscripts:$Tj"
-      end
-      input $testscripts:$Tj
-      for Tk 0 $tests:n
-        if ($VERBOSE > 2)
-          echo "   running $tests:$Tk"
-        end
-        $tests:$Tk
-        if ($PASS == 0)
-          echo "   ** failed test $tests:$Tk"
-          $Nfail ++
-          $n = $failtest:n
-	  $failtest:$n = $tests:$Tk
-	  $failfile:$n = $testscripts:$Tj
-	  $faildirs:$n = $testdir:$Ti
-          $failtest:n ++
-          $failfile:n ++
-          $faildirs:n ++
-        else
-          $Npass ++
-        end
-        $Ntest ++
-        # echo "finished $tests:$Tk"
-      end
-      # echo "finished $testscripts:n test scripts from $testscripts:$Tj"
-    end
-    # echo "finished tests from $testdir:$Ti"
+    runtestdir $testdir:$Ti
   end
 
@@ -54,4 +32,5 @@
 
   if ($Nfail > 0) 
+    echo " ** failed tests **"
     for i 0 $Nfail
       echo $faildirs:$i $failfile:$i $failtest:$i
@@ -60,2 +39,56 @@
 end
 
+macro runtestdir
+  if ($0 != 2)
+    echo "USAGE: runtestdir (testdir)"
+    break -auto on
+    break
+  end
+  
+  pwd -var startdir
+  cd -q $1
+  list testscripts -x "ls *.sh"
+
+  $currentdir = $1
+  for Tj 0 $testscripts:n
+    if ($VERBOSE > 1)
+      echo " running $testscripts:$Tj"
+    end
+    runtests $testscripts:$Tj      
+  end
+  
+  cd -q $startdir
+end
+
+macro runtests
+  if ($0 != 2)
+    echo "USAGE: runtests (script.sh)"
+    break -auto on
+    break
+  end
+  
+  local Tk
+
+  input $1
+  for Tk 0 $tests:n
+    if ($VERBOSE > 2)
+      echo "   running $tests:$Tk"
+    end
+    $tests:$Tk
+    if ($PASS == 0)
+      echo "   ** failed $tests:$Tk $1"
+      $Nfail ++
+      $n = $failtest:n
+      $failtest:$n = $tests:$Tk
+      $failfile:$n = $1
+      $faildirs:$n = $currentdir
+      $failtest:n ++
+      $failfile:n ++
+      $faildirs:n ++
+    else
+      $Npass ++
+    end
+    $Ntest ++
+    # echo "finished $tests:$Tk"
+  end
+end
