sniper          Wed Jun 15 05:21:15 2005 EDT

  Modified files:              
    /php-src    run-tests.php 
  Log:
  Show borked tests in the summary
  
http://cvs.php.net/diff.php/php-src/run-tests.php?r1=1.212&r2=1.213&ty=u
Index: php-src/run-tests.php
diff -u php-src/run-tests.php:1.212 php-src/run-tests.php:1.213
--- php-src/run-tests.php:1.212 Thu Apr  7 16:22:55 2005
+++ php-src/run-tests.php       Wed Jun 15 05:21:15 2005
@@ -490,7 +490,7 @@
                $failed_tests_data .= $summary . "\n";
 
                if ($sum_results['FAILED']) {
-                       foreach ($PHP_FAILED_TESTS as $test_info) {
+                       foreach ($PHP_FAILED_TESTS['FAILED'] as $test_info) {
                                $failed_tests_data .= $sep . $test_info['name'] 
. $test_info['info'];
                                $failed_tests_data .= $sep . 
file_get_contents(realpath($test_info['output']));
                                $failed_tests_data .= $sep . 
file_get_contents(realpath($test_info['diff']));
@@ -705,15 +705,17 @@
 
        $fp = @fopen($file, "r") or error("Cannot open test file: $file");
 
+       $borked = false;
+       $bork_info = '';
        if (!feof($fp)) {
                $line = fgets($fp);
        } else {
-               echo "BORK empty test [$file]\n";
-               return 'BORKED';
+               $bork_info = "empty test [$file]";
+               $borked = true;
        }
        if (!ereg('^--TEST--',$line,$r)) {
-               echo "BORK tests must start with --TEST-- [$file]\n";
-               return 'BORKED';
+               $bork_info = "tests must start with --TEST-- [$file]";
+               $borked = true;
        }
        $section = 'TEST';
        while (!feof($fp)) {
@@ -730,15 +732,27 @@
                $section_text[$section] .= $line;
        }
        if (@count($section_text['FILE']) != 1) {
-               echo "BORK missing section --FILE-- [$file]\n";
-               return 'BORKED';
+               $bork_info = "missing section --FILE-- [$file]";
+               $borked = true;
        }
        if ((@count($section_text['EXPECT']) + @count($section_text['EXPECTF']) 
+ @count($section_text['EXPECTREGEX'])) != 1) {
-               echo "BORK missing section --EXPECT--, --EXPECTF-- or 
--EXPECTREGEX-- [$file]\n";
-               return 'BORKED';
+               $bork_info = "missing section --EXPECT--, --EXPECTF-- or 
--EXPECTREGEX-- [$file]";
+               $borked = true;
        }
        fclose($fp);
 
+       if ($borked) {
+               echo "BORK $bork_info [$file]\n";
+               $PHP_FAILED_TESTS['BORKED'][] = array (
+                                                               'name' => $file,
+                                                               'test_name' => 
'',
+                                                               'output' => '',
+                                                               'diff'   => '',
+                                                               'info'   => 
$bork_info,
+               );
+               return 'BORKED';
+       }
+
        /* For GET/POST tests, check if cgi sapi is available and if it is, use 
it. */
        if ((!empty($section_text['GET']) || !empty($section_text['POST']))) {
                if (file_exists("./sapi/cgi/php")) {
@@ -946,7 +960,7 @@
                echo "FAIL $tested$info\n";
        }
 
-       $PHP_FAILED_TESTS[] = array(
+       $PHP_FAILED_TESTS['FAILED'][] = array (
                                                'name' => $file,
                                                'test_name' => $tested,
                                                'output' => 
ereg_replace('\.phpt$','.log', $file),
@@ -1198,16 +1212,28 @@
 =====================================================================
 ";
        $failed_test_summary = '';
-       if (count($PHP_FAILED_TESTS)) {
+       if (count($PHP_FAILED_TESTS['BORKED'])) {
                $failed_test_summary .= "
 =====================================================================
-FAILED TEST SUMMARY
+BORKED TEST SUMMARY
 ---------------------------------------------------------------------
 ";
-       foreach ($PHP_FAILED_TESTS as $failed_test_data) {
-               $failed_test_summary .=  $failed_test_data['test_name'] . 
$failed_test_data['info'] . "\n";
+               foreach ($PHP_FAILED_TESTS['BORKED'] as $failed_test_data) {
+                       $failed_test_summary .= $failed_test_data['info'] . 
"\n";
+               }
+               $failed_test_summary .=  
"=====================================================================\n";
        }
-       $failed_test_summary .=  
"=====================================================================\n";
+       
+       if (count($PHP_FAILED_TESTS['FAILED'])) {
+               $failed_test_summary .= "
+=====================================================================
+FAILED TEST SUMMARY
+---------------------------------------------------------------------
+";
+               foreach ($PHP_FAILED_TESTS['FAILED'] as $failed_test_data) {
+                       $failed_test_summary .= $failed_test_data['test_name'] 
. $failed_test_data['info'] . "\n";
+               }
+               $failed_test_summary .=  
"=====================================================================\n";
        }
        
        if ($failed_test_summary && !getenv('NO_PHPTEST_SUMMARY')) {

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

Reply via email to