zoe             Sun May 25 16:05:05 2008 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src    run-tests.php 
  Log:
  Added --XFAIL-- section
  
http://cvs.php.net/viewvc.cgi/php-src/run-tests.php?r1=1.226.2.37.2.35.2.19&r2=1.226.2.37.2.35.2.20&diff_format=u
Index: php-src/run-tests.php
diff -u php-src/run-tests.php:1.226.2.37.2.35.2.19 
php-src/run-tests.php:1.226.2.37.2.35.2.20
--- php-src/run-tests.php:1.226.2.37.2.35.2.19  Mon Mar 17 17:18:19 2008
+++ php-src/run-tests.php       Sun May 25 16:05:04 2008
@@ -24,7 +24,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: run-tests.php,v 1.226.2.37.2.35.2.19 2008/03/17 17:18:19 nlopess Exp $ 
*/
+/* $Id: run-tests.php,v 1.226.2.37.2.35.2.20 2008/05/25 16:05:04 zoe Exp $ */
 
 /* Sanity check to ensure that pcre extension needed by this script is 
available.
  * In the event it is not, print a nice error message indicating that this 
script will
@@ -260,7 +260,7 @@
 $test_files = array();
 $redir_tests = array();
 $test_results = array();
-$PHP_FAILED_TESTS = array('BORKED' => array(), 'FAILED' => array(), 'WARNED' 
=> array(), 'LEAKED' => array());
+$PHP_FAILED_TESTS = array('BORKED' => array(), 'FAILED' => array(), 'WARNED' 
=> array(), 'LEAKED' => array(), 'XFAILED' => array());
 
 // If parameters given assume they represent selected tests to run.
 $failed_tests_file= false;
@@ -441,7 +441,7 @@
                                        $html_output = is_resource($html_file);
                                        break;
                                case '--version':
-                                       echo '$Revision: 1.226.2.37.2.35.2.19 
$'."\n";
+                                       echo '$Revision: 1.226.2.37.2.35.2.20 
$'."\n";
                                        exit(1);
 
                                case 'u':
@@ -712,7 +712,7 @@
 /* We got failed Tests, offer the user to send an e-mail to QA team, unless 
NO_INTERACTION is set */
 if (!getenv('NO_INTERACTION')) {
        $fp = fopen("php://stdin", "r+");
-       if ($sum_results['FAILED'] || $sum_results['BORKED'] || 
$sum_results['WARNED'] || $sum_results['LEAKED']) {
+       if ($sum_results['FAILED'] || $sum_results['BORKED'] || 
$sum_results['WARNED'] || $sum_results['LEAKED'] || $sum_results['XFAILED']) {
                echo "\nYou may have found a problem in PHP.";
        }
        echo "\nWe would like to send this report automatically to the\n";
@@ -748,8 +748,8 @@
                
                $failed_tests_data .= $failed_test_summary . "\n";
                $failed_tests_data .= get_summary(true, false) . "\n";
-
-               if ($sum_results['FAILED']) {
+               //Not sending XFAIL results since failure is intentional.
+               if ($sum_results['FAILED'] ) {
                        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']));
@@ -981,7 +981,7 @@
                if (!is_array($name) && $result != 'REDIR')
                {
                        $test_results[$index] = $result;
-                       if ($failed_tests_file && ($result == 'FAILED' || 
$result == 'WARNED' || $result == 'LEAKED'))
+                       if ($failed_tests_file && ($result = 'XFAILED' || 
$result == 'FAILED' || $result == 'WARNED' || $result == 'LEAKED'))
                        {
                                fwrite($failed_tests_file, "$index\n");
                        }
@@ -1627,7 +1627,11 @@
                $restype[] = 'WARN';
        }
        if (!$passed) {
-               $restype[] = 'FAIL';
+               if(isset($section_text['XFAIL'])) {
+                       $restype[] = 'XFAIL';
+               }else{
+                       $restype[] = 'FAIL';
+               }
        }
 
        if (!$passed) {
@@ -1840,7 +1844,7 @@
 
        $n_total = count($test_results);
        $n_total += $ignored_by_ext;
-       $sum_results = array('PASSED'=>0, 'WARNED'=>0, 'SKIPPED'=>0, 
'FAILED'=>0, 'BORKED'=>0, 'LEAKED'=>0);
+       $sum_results = array('PASSED'=>0, 'WARNED'=>0, 'SKIPPED'=>0, 
'FAILED'=>0, 'BORKED'=>0, 'LEAKED'=>0, 'XFAILED'=>0);
        foreach ($test_results as $v) {
                $sum_results[$v]++;
        }
@@ -1859,10 +1863,11 @@
        if ($x_total) {
                $x_warned = (100.0 * $sum_results['WARNED']) / $x_total;
                $x_failed = (100.0 * $sum_results['FAILED']) / $x_total;
+               $x_xfailed = (100.0 * $sum_results['XFAILED']) / $x_total;
                $x_leaked = (100.0 * $sum_results['LEAKED']) / $x_total;
                $x_passed = (100.0 * $sum_results['PASSED']) / $x_total;
        } else {
-               $x_warned = $x_failed = $x_passed = $x_leaked = 0;
+               $x_warned = $x_failed = $x_passed = $x_leaked = $x_xfailed = 0;
        }
 
        $summary = "";
@@ -1886,7 +1891,8 @@
        $summary .= "
 Tests skipped   : " . sprintf("%4d 
(%5.1f%%)",$sum_results['SKIPPED'],$percent_results['SKIPPED']) . " --------
 Tests warned    : " . sprintf("%4d (%5.1f%%)",$sum_results['WARNED'], 
$percent_results['WARNED']) . " " . sprintf("(%5.1f%%)",$x_warned) . "
-Tests failed    : " . sprintf("%4d (%5.1f%%)",$sum_results['FAILED'], 
$percent_results['FAILED']) . " " . sprintf("(%5.1f%%)",$x_failed);
+Tests failed    : " . sprintf("%4d (%5.1f%%)",$sum_results['FAILED'], 
$percent_results['FAILED']) . " " . sprintf("(%5.1f%%)",$x_failed) . "
+Expected fail   : " . sprintf("%4d (%5.1f%%)",$sum_results['XFAILED'], 
$percent_results['XFAILED']) . " " . sprintf("(%5.1f%%)",$x_xfailed);
        if ($leak_check) {
                $summary .= "
 Tests leaked    : " . sprintf("%4d (%5.1f%%)",$sum_results['LEAKED'], 
$percent_results['LEAKED']) . " " . sprintf("(%5.1f%%)",$x_leaked);
@@ -1921,6 +1927,17 @@
                }
                $failed_test_summary .=  
"=====================================================================\n";
        }
+       if (count($PHP_FAILED_TESTS['XFAILED'])) {
+               $failed_test_summary .= "
+=====================================================================
+EXPECTED FAILED TEST SUMMARY
+---------------------------------------------------------------------
+";
+               foreach ($PHP_FAILED_TESTS['XFAILED'] as $failed_test_data) {
+                       $failed_test_summary .= $failed_test_data['test_name'] 
. $failed_test_data['info'] . "\n";
+               }
+               $failed_test_summary .=  
"=====================================================================\n";
+       }
        
        if (count($PHP_FAILED_TESTS['LEAKED'])) {
                $failed_test_summary .= "



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

Reply via email to