Commit:    b2e14bfd6b93f94e624988db9ed1544332529a1a
Author:    zoe slattery <z...@php.net>         Sat, 13 Oct 2012 12:59:24 +0100
Parents:   3fde97a0ea76fa12f6534a7e207e32ebd5332bbd
Branches:  master

Link:       
http://git.php.net/?p=phpruntests.git;a=commitdiff;h=b2e14bfd6b93f94e624988db9ed1544332529a1a

Log:
fix bugs in output writer, add .phpt to putput file names

Changed paths:
  M  QA/compareNewOld.php
  M  src/testcase/output/rtTestOutputWriterCSV.php
  M  src/testcase/rtTestOutputWriter.php
  M  src/testrun/rtPhpTestRun.php


Diff:
diff --git a/QA/compareNewOld.php b/QA/compareNewOld.php
index 2d2d999..5cd33ab 100644
--- a/QA/compareNewOld.php
+++ b/QA/compareNewOld.php
@@ -58,10 +58,10 @@ function parseNew($output, $searchFor, $top_level) {
                if 
(preg_match("/$top_level\/((ext|sapi|Zend|tests)\/\S+)\s{1},(.*)\s{1}$searchFor\s{1}/",
 $line, $matches)) {
                                 if($searchFor == 'FAIL') {
                                  if(!preg_match("/XFAIL/", $line)) {
-                                               $result[] = $matches[1] . 
".phpt";
+                                               $result[] = $matches[1];
                                }
                                 } else {
-                                       $result[] = $matches[1] . ".phpt";
+                                       $result[] = $matches[1];
                          }
                }
 
diff --git a/src/testcase/output/rtTestOutputWriterCSV.php 
b/src/testcase/output/rtTestOutputWriterCSV.php
index b0e48c9..9ae27a7 100644
--- a/src/testcase/output/rtTestOutputWriterCSV.php
+++ b/src/testcase/output/rtTestOutputWriterCSV.php
@@ -29,7 +29,7 @@ class rtTestOutputWriterCSV extends rtTestOutputWriter
                
                foreach ($testGroupResults as $testName=>$status) {
                    
-                       $outputString = $testName;
+                       $outputString = $testName . ".phpt";
                    
                    
                    foreach($status->getTestStateNames() as $name) {
diff --git a/src/testcase/rtTestOutputWriter.php 
b/src/testcase/rtTestOutputWriter.php
index b20638a..0623292 100644
--- a/src/testcase/rtTestOutputWriter.php
+++ b/src/testcase/rtTestOutputWriter.php
@@ -98,20 +98,19 @@ abstract class rtTestOutputWriter
      * @param  integer $processCount
      * @return string
      */
-    public function getOverview($parallelGroups = 0, $serialGroups= 0, 
$processCount= 1)
+    public function getOverview($parallelGroups = 0, $serialGroups= 0, 
$processCount)
     {
        // if the overview was already created retun it
        if (!is_null($this->overview)) {
                return $this->overview;
        }
-       
+    
        /*
-        * Add one to the process count (it should represesnt the number or 
processes, not the nubmer of
-        * proccess in addition to the one that you have to have anyway!
+        * Add one to the process count if it's 0. There must always be one 
process - right?
         */
-       
-       $processCount ++;
-       
+       if($processCount == 0) {
+               $processCount ++;
+       }
        
        // collect data         
        $state = array();
@@ -195,9 +194,9 @@ abstract class rtTestOutputWriter
     }
     
     
-    public function printOverview($groups=NULL, $processCount=NULL) {
+    public function printOverview($parallelGroups=NULL, $serialGroups = NULL, 
$processCount=NULL) {
        
-       print $this->getOverview($groups, $processCount);
+       print $this->getOverview($parallelGroups, $serialGroups, $processCount);
        flush();
     }
     
@@ -229,7 +228,7 @@ abstract class rtTestOutputWriter
                case 1:         // every test-case incl. status
                        print "\n";
                                foreach ($results as $name=>$status) {
-                                       print 
strtoupper($status->__toString())."\t".$name."\n";
+                                       print 
strtoupper($status->__toString())."\t".$name.".phpt\n";
                                }
                        break;
 
@@ -244,7 +243,7 @@ abstract class rtTestOutputWriter
                                                print "\n";
                                        }
                                        
-                                       print strtoupper($s)."\t".$name."\n";
+                                       print 
strtoupper($s)."\t".$name.".phpt\n";
 
                                 if ($s !== 'pass') {
                                                                                
@@ -267,7 +266,7 @@ abstract class rtTestOutputWriter
                                        
                                        print "\n";
                                        
-                                       print 
strtoupper($status)."\t".$name."\n";
+                                       print 
strtoupper($status)."\t".$name.".phpt\n";
                                
                                $msg = $s->getMessage($status);
 
diff --git a/src/testrun/rtPhpTestRun.php b/src/testrun/rtPhpTestRun.php
index 5cd8593..b03a9a8 100644
--- a/src/testrun/rtPhpTestRun.php
+++ b/src/testrun/rtPhpTestRun.php
@@ -24,6 +24,7 @@ class rtPhpTestRun
        protected $reportStatus = 0;
        protected $numberOfSerialGroups = 0;
        protected $numberOfParallelGroups = 0;
+       protected $processorCount;
 
        public function __construct($argv)
        {
@@ -66,6 +67,8 @@ class rtPhpTestRun
                //Set reporting option
                $this->setReportStatus();
                
+               $this->processorCount = $this->requestedProcessorCount();
+               
 
         /*
          * Main decision point. Either we start this with a directory (or set 
of directories, in which case tests are 
@@ -113,7 +116,7 @@ class rtPhpTestRun
                        } else {
                                
                                //check to see if this is set to be a parallel 
run, if not, run the subdirectory groups in sequence.
-                               if($this->requestedProcessorCount() < 1) {
+                               if($this->processorCount <= 1) {
                                        
$this->run_serial_groups($subDirectories, $groupConfigurations);
                                        $this->numberOfSerialGroups = 
count($subDirectories);
                                } else {
@@ -131,7 +134,7 @@ class rtPhpTestRun
                                        
                                        $this->numberOfParallelGroups = 
count($parallelGroups);
                                        
-                                       
$this->run_parallel_groups($parallelGroups, $groupConfigurations, 
$this->requestedProcessorCount());
+                                       
$this->run_parallel_groups($parallelGroups, $groupConfigurations, 
$this->processorCount);
                                        if($this->numberOfSerialGroups > 0)     
{                       
                                                
$this->run_serial_groups($serialGroups, $groupConfigurations);  
                                        }                               
@@ -295,7 +298,7 @@ class rtPhpTestRun
                $processCount = 0;
                if ($this->runConfiguration->hasCommandLineOption('z')) {
                         
-                       $processCount = 
$this->runConfiguration->getCommandLineOption('z');
+                       $processCount = 
intval($this->runConfiguration->getCommandLineOption('z'));
                         
                        if (!is_numeric($processCount) || $processCount < 0) {
                                $processCount = 2;
@@ -333,7 +336,7 @@ class rtPhpTestRun
                $outputWriter = rtTestOutputWriter::getInstance($type);
                $outputWriter->setResultList($this->resultList);
                
-               $outputWriter->printOverview($this->numberOfParallelGroups, 
$this->numberOfSerialGroups, $this->requestedProcessorCount());
+                               
$outputWriter->printOverview($this->numberOfParallelGroups, 
$this->numberOfSerialGroups, $this->processorCount);
 
                $filename = null;
                if ($this->runConfiguration->hasCommandLineOption('s')) {


--
PHP Quality Assurance Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to