From a71f734dec3c76675a8dd080dab88ab0e91c44b1 Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Mon, 4 Nov 2002 10:45:41 +0000 Subject: [PATCH] move the run-test tests to the top #if one of these fails there is no need for further testing --- run-tests.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) 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(); -- 2.50.1