From: Marcus Boerger Date: Mon, 4 Nov 2002 10:45:41 +0000 (+0000) Subject: move the run-test tests to the top X-Git-Tag: php-4.3.0RC1~301 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a71f734dec3c76675a8dd080dab88ab0e91c44b1;p=php move the run-test tests to the top #if one of these fails there is no need for further testing --- diff --git a/run-tests.php b/run-tests.php index de6ba5edfa..24b6ef8de6 100755 --- a/run-tests.php +++ b/run-tests.php @@ -158,7 +158,7 @@ if (isset($argc) && $argc > 1) { // Run selected tests. if (count($test_files)) { - asort($test_files); + usort($test_files, "test_sort"); echo "Running selected tests.\n"; foreach($test_files AS $name) { $test_results[$name] = run_test($php,$name); @@ -220,7 +220,19 @@ function find_files($dir,$is_ext_dir=FALSE,$ignore=FALSE) closedir($o); } -sort($test_files); +function test_sort($a, $b) { + global $cwd; + + $ta = strpos($a, "{$cwd}/tests/run-test")===0 ? 1 : 0; + $tb = strpos($b, "{$cwd}/tests/run-test")===0 ? 1 : 0; + if ($ta == $tb) { + return strcmp($a, $b); + } else { + return $ta ? -1 : +1; + } +} + +usort($test_files, "test_sort"); $start_time = time();