helly           Fri Oct  4 17:19:56 2002 EDT

  Modified files:              
    /php4       run-tests.php 
  Log:
  Return to old counting where every test is counted (even those of skipped
  extensions). Inform about the number of extensions tested and skipped.
  This makes the test summary more compareable.
  
  Maybe i'll add a parameter/env-var to skip extension tests. That way we
  could fasten tests for changes in the core. But it has to wait some days.
  
  
Index: php4/run-tests.php
diff -u php4/run-tests.php:1.58 php4/run-tests.php:1.59
--- php4/run-tests.php:1.58     Thu Oct  3 14:25:30 2002
+++ php4/run-tests.php  Fri Oct  4 17:19:51 2002
@@ -137,28 +137,29 @@
 // Compile a list of all test files (*.phpt).
 $test_files = array();
 $exts_to_test = get_loaded_extensions();
+$exts_tested = count($exts_to_test);
+$exts_skipped = 0;
+$ignored_by_ext = 0;
 sort($exts_to_test);
-$extra_dirs = array('pear', 'tests');
+$test_dirs = array('tests', 'pear', 'ext');
 $cwd=getcwd();
 
-// First get list of test files in ext/ 
-foreach ($exts_to_test as $dir) {
-       find_files("{$cwd}/ext/{$dir}");
+foreach ($test_dirs as $dir) {
+       find_files("{$cwd}/{$dir}", $dir=='ext');
 }
 
-// Then the rest
-foreach ($extra_dirs as $dir) {
-       find_files("{$cwd}/{$dir}");
-}
-
-function find_files($dir)
+function find_files($dir,$is_ext_dir=false,$ignore=false)
 {
-       global $test_files;
+       global $test_files, $exts_to_test, $ignored_by_ext, $exts_skipped, 
+$exts_tested;
 
        $o = opendir($dir) or error("cannot open directory: $dir");
        while (($name = readdir($o)) !== false) {
                if (is_dir("{$dir}/{$name}") && !in_array($name, array('.', '..', 
'CVS'))) {
-                       find_files("{$dir}/{$name}");
+                       $skip_ext = ($is_ext_dir && !in_array($name, $exts_to_test));
+                       if ($skip_ext) {
+                               $exts_skipped++;
+                       }
+                       find_files("{$dir}/{$name}", false, $ignore || $skip_ext);
            }
        
                // Cleanup any left-over tmp files from last run.
@@ -169,8 +170,12 @@
 
                // Otherwise we're only interested in *.phpt files.
                if (substr($name, -5) == '.phpt') {
-                       $testfile = realpath("{$dir}/{$name}");
-                       $test_files[] = $testfile;
+                       if ($ignore) {
+                               $ignored_by_ext++;
+                       } else {
+                               $testfile = realpath("{$dir}/{$name}");
+                               $test_files[] = $testfile;
+                       }
                }
        }
        closedir($o);
@@ -206,10 +211,13 @@
 }
 
 $n_total = count($test_results);
+$n_total += $ignored_by_ext;
+
 $sum_results = array('PASSED'=>0, 'SKIPPED'=>0, 'FAILED'=>0);
 foreach ($test_results as $v) {
     $sum_results[$v]++;
 }
+$sum_results['SKIPPED'] += $ignored_by_ext;
 $percent_results = array();
 while (list($v,$n) = each($sum_results)) {
     $percent_results[$v] = (100.0 * $n) / $n_total;
@@ -221,10 +229,14 @@
 =====================================================================
 TEST RESULT SUMMARY
 ---------------------------------------------------------------------
+Exts skipped    : " . sprintf("%4d",$exts_skipped) . "
+Exts tested     : " . sprintf("%4d",$exts_tested) . "
+---------------------------------------------------------------------
 Number of tests : " . sprintf("%4d",$n_total) . "
 Tests skipped   : " . sprintf("%4d 
(%2.1f%%)",$sum_results['SKIPPED'],$percent_results['SKIPPED']) . "
 Tests failed    : " . sprintf("%4d 
(%2.1f%%)",$sum_results['FAILED'],$percent_results['FAILED']) . "
 Tests passed    : " . sprintf("%4d 
(%2.1f%%)",$sum_results['PASSED'],$percent_results['PASSED']) . "
+---------------------------------------------------------------------
 Time taken      : " . sprintf("%4d seconds", $end_time - $start_time) . "
 =====================================================================
 ";



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to