]> granicus.if.org Git - php/commitdiff
MFH:- Allow using * in test filenames to match pattern
authorJani Taskinen <jani@php.net>
Tue, 31 Jul 2007 21:29:21 +0000 (21:29 +0000)
committerJani Taskinen <jani@php.net>
Tue, 31 Jul 2007 21:29:21 +0000 (21:29 +0000)
run-tests.php

index b4fcdf740ab1486425ec94c49a1554ed37df99fe..f360af267cf524e250c2c81592366860ec50c01e 100755 (executable)
@@ -474,7 +474,18 @@ HELP;
                }
                if (!$is_switch) {
                        $testfile = realpath($argv[$i]);
-                       if (is_dir($testfile)) {
+                       if (!$testfile && strpos($argv[$i], '*') !== false && function_exists('glob')) {
+                               if (preg_match("/\.phpt$/", $argv[$i])) {
+                                       $pattern_match = glob($argv[$i]);
+                               } else if (preg_match("/\*$/", $argv[$i])) {
+                                       $pattern_match = glob($argv[$i] . '.phpt');
+                               } else {
+                                       die("bogus test name " . $argv[$i] . "\n");
+                               }
+                               if (is_array($pattern_match)) {
+                                       $test_files = array_merge($test_files, $pattern_match);
+                               }
+                       } else if (is_dir($testfile)) {
                                find_files($testfile);
                        } else if (preg_match("/\.phpt$/", $testfile)) {
                                $test_files[] = $testfile;