]> granicus.if.org Git - php/commitdiff
-allow parameters to be directories
authorMarcus Boerger <helly@php.net>
Sat, 2 Nov 2002 21:48:05 +0000 (21:48 +0000)
committerMarcus Boerger <helly@php.net>
Sat, 2 Nov 2002 21:48:05 +0000 (21:48 +0000)
-"${dir}" -> $dir

run-tests.php

index 464c76946b488c59ce6433531f6eac398cf6b1c7..0d6b028fdf5eac666b05bf9a989480e5c4e425f2 100755 (executable)
@@ -139,7 +139,6 @@ echo "
 
 // Determine the tests to be run.
 
-$test_to_run = array();
 $test_files = array();
 $test_results = array();
 $GLOBALS['__PHP_FAILED_TESTS__'] = array();
@@ -148,18 +147,18 @@ $GLOBALS['__PHP_FAILED_TESTS__'] = array();
 if (isset($argc) && $argc > 1) {
        for ($i=1; $i<$argc; $i++) {
                $testfile = realpath($argv[$i]);
-               $test_to_run[$testfile] = 1;
+               if (is_dir($testfile)) {
+                       find_files($testfile);
+               } else if(preg_match("/\.phpt$/", $name)) {
+                       $test_files[] = $testfile;
+               }
        }
 
        // Run selected tests.
-       if (count($test_to_run)) {
+       if (count($test_files)) {
                echo "Running selected tests.\n";
-               foreach($test_to_run AS $name=>$runnable) {
-                       if(!preg_match("/\.phpt$/", $name))
-                               continue;
-                       if ($runnable) {
-                               $test_results[$name] = run_test($php,$name);
-                       }
+               foreach($test_files AS $name) {
+                       $test_results[$name] = run_test($php,$name);
                }
                if(getenv('REPORT_EXIT_STATUS') == 1 and ereg('FAILED( |$)', implode(' ', $test_results))) {
                        exit(1);
@@ -182,7 +181,7 @@ foreach ($test_dirs as $dir) {
 }
 
 foreach ($user_tests as $dir) {
-       find_files("{$dir}", ($dir == 'ext'));
+       find_files($dir, ($dir == 'ext'));
 }
 
 function find_files($dir,$is_ext_dir=FALSE,$ignore=FALSE)