[PHP-CVS] svn: php/phpruntests/trunk/src/taskScheduler/

2009-07-15 Thread Zoe Slattery
zoe Wed, 15 Jul 2009 10:35:04 +

URL: http://svn.php.net/viewvc?view=revisionrevision=284111

Changed paths:
U   php/phpruntests/trunk/src/taskScheduler/rtTaskSchedulerFile.php
U   php/phpruntests/trunk/src/testcase/rtPhpRunner.php
U   php/phpruntests/trunk/src/testcase/rtPhpTest.php
U   php/phpruntests/trunk/src/testcase/rtPhpTestFile.php
U   
php/phpruntests/trunk/src/testcase/sections/executablesections/rtCleanSection.php
U   
php/phpruntests/trunk/src/testcase/sections/executablesections/rtFileSection.php
U   
php/phpruntests/trunk/src/testcase/sections/executablesections/rtSkipIfSection.php
U   php/phpruntests/trunk/src/testgroup/rtPhpTestGroup.php
U   php/phpruntests/trunk/src/testrun/rtPhpTestRun.php

Log:
Fixing the parser to deal with empty sections
Modified: php/phpruntests/trunk/src/taskScheduler/rtTaskSchedulerFile.php
===
--- php/phpruntests/trunk/src/taskScheduler/rtTaskSchedulerFile.php	2009-07-15 10:17:04 UTC (rev 284110)
+++ php/phpruntests/trunk/src/taskScheduler/rtTaskSchedulerFile.php	2009-07-15 10:35:04 UTC (rev 284111)
@@ -21,18 +21,6 @@
 	private $groupTasks = false;	// are the tasks stored in groups?


-	/**
-	 * the signal-handler is called by the interrupt- or quit-signal. this is
-	 * necessary to cleanup the tmp files and terminate the script correct.
-	 *
-	 * @param int $signal
-	 */
-	public static function signalHandler($signal)
-	{
-		exit(0);
-	}
-
-
 /**
  * sets the task-list which has to be an array of task-objects.
  * it's also possible to use a multidimensional array. in this case the
@@ -88,9 +76,7 @@
 		if ($this-processCount  sizeof($this-taskList)) {
 			$this-processCount = sizeof($this-taskList);
 		}
-

-
 		// distribute the task to the children
 		$this-distributeTasks();

@@ -113,14 +99,7 @@
 	break;
 			}
 		}
-
-
-		// register signal-handler
-		/*
-		pcntl_signal(SIGINT, rtTaskSchedulerFile::signalHandler);
-		pcntl_signal(SIGQUIT, rtTaskSchedulerFile::signalHandler);
-		*/
-
+
 		// wait until all child-processes are terminated
 		for ($i=0; $i$this-processCount; $i++) {
 			pcntl_waitpid($this-pidStore[$i], $status);
@@ -195,8 +174,6 @@

 			unlink(self::TMP_FILE.$cid);
 		}
-
-		$this-pidStore = array();
 	}



Modified: php/phpruntests/trunk/src/testcase/rtPhpRunner.php
===
--- php/phpruntests/trunk/src/testcase/rtPhpRunner.php	2009-07-15 10:17:04 UTC (rev 284110)
+++ php/phpruntests/trunk/src/testcase/rtPhpRunner.php	2009-07-15 10:35:04 UTC (rev 284111)
@@ -58,8 +58,6 @@

 fclose($pipes[0]);

-$counter = 0;
-
 while (true) {
 /* hide errors from interrupted syscalls */
 $r = $pipes;
@@ -69,19 +67,14 @@
 $n = @stream_select($r, $w, $e, $this-timeOut);

 if ($n === false) {
-throw new rtException('Stream select failure in rtPhpRunner');
+throw new rtPhpRunnerException('Stream select failure in rtPhpRunner');
 } else if ($n === 0) {
 proc_terminate($proc);
-throw new rtException('The process running test code has timed out in rtPhpRunner');
+throw new rtPhpRunnerException ('The process running test code has timed out in rtPhpRunner');
 } else if ($n  0) {
-	$counter++;
-	if ($counter  100) {
-		proc_terminate($proc);
-		throw new rtException('The process running test code has timed out in rtPhpRunner');
-	}
-	$line = fread($pipes[1], 8192);
+$line = fread($pipes[1], 8192);
 if (strlen($line) == 0) {
-// EOF
+/* EOF */
 break;
 }
 $data .= (binary) $line;

Modified: php/phpruntests/trunk/src/testcase/rtPhpTest.php
===
--- php/phpruntests/trunk/src/testcase/rtPhpTest.php	2009-07-15 10:17:04 UTC (rev 284110)
+++ php/phpruntests/trunk/src/testcase/rtPhpTest.php	2009-07-15 10:35:04 UTC (rev 284111)
@@ -42,7 +42,7 @@
 {
 $lastSection = end($this-sectionHeadings);
 $start=0;
-
+
 foreach($this-sectionHeadings as $keyNumber = $sectionKey) {

 if($keyNumber  count($this-sectionHeadings) - 1) {
@@ -53,9 +53,9 @@
 for($index=$start; $indexcount($this-contents); $index++)
 if($this-contents[$index] == --.$sectionKey.--) {
 //Found the beginning of the section
-
+
 for($contentsLine=$index + 1; $contentsLinecount($this-contents); $contentsLine ++) {
-
+
 if( ($this-contents[$contentsLine] == --.$nextKey.--) || ($contentsLine == count($this-contents))) {
 //Found the end 

[PHP-CVS] svn: php/phpruntests/trunk/src/taskScheduler/

2009-07-15 Thread Georg Gradwohl
g2  Wed, 15 Jul 2009 20:59:08 +

URL: http://svn.php.net/viewvc?view=revisionrevision=284147

Changed paths:
U   php/phpruntests/trunk/src/taskScheduler/rtTaskSchedulerFile.php

Log:
minor bugifx to avoid warning

Modified: php/phpruntests/trunk/src/taskScheduler/rtTaskSchedulerFile.php
===
--- php/phpruntests/trunk/src/taskScheduler/rtTaskSchedulerFile.php 
2009-07-15 19:16:58 UTC (rev 284146)
+++ php/phpruntests/trunk/src/taskScheduler/rtTaskSchedulerFile.php 
2009-07-15 20:59:08 UTC (rev 284147)
@@ -21,6 +21,18 @@
private $groupTasks = false;// are the tasks stored in groups?


+   /**
+* the signal-handler is called by the interrupt- or quit-signal. this 
is
+* necessary to cleanup the tmp files and terminate the script correct.
+*
+* @param int $signal
+*/
+   public static function signalHandler($signal)
+   {
+   exit(0);
+   }
+
+
 /**
  * sets the task-list which has to be an array of task-objects.
  * it's also possible to use a multidimensional array. in this case the
@@ -33,7 +45,7 @@
  */
public function setTaskList(array $taskList)
{
-   if (is_array($taskList[0])) {
+   if (isset($taskList[0])  is_array($taskList[0])) {
$this-groupTasks = true;
$this-processCount = sizeof($taskList);
}
@@ -77,6 +89,7 @@
$this-processCount = sizeof($this-taskList);
}

+
// distribute the task to the children
$this-distributeTasks();

@@ -99,7 +112,12 @@
break;
}
}
+
+   // register signal-handler
+   pcntl_signal(SIGINT, rtTaskSchedulerFile::signalHandler);
+   pcntl_signal(SIGQUIT, rtTaskSchedulerFile::signalHandler);

+
// wait until all child-processes are terminated
for ($i=0; $i$this-processCount; $i++) {
pcntl_waitpid($this-pidStore[$i], $status);
@@ -160,16 +178,16 @@
$response = explode([END], $response);
array_pop($response);

-   foreach ($response as $resultList) {
+   foreach ($response as $testGroupResults) {

-   $resultList = unserialize($resultList);
+   $testGroupResults = 
unserialize($testGroupResults);

-   if ($resultList === false) {
+   if ($testGroupResults === false) {
print ERROR unserialize - receiver 
$cid\n;
continue;
}
-
-   $this-resultList = 
array_merge($this-resultList, $resultList);
+
+   $this-resultList[] = $testGroupResults;
}

unlink(self::TMP_FILE.$cid);
@@ -194,6 +212,8 @@

foreach ($taskList as $task) {

+   $s = microtime(true);
+
$task = unserialize($task);

if ($task === false) {
@@ -202,8 +222,15 @@
}

$task-run();
+
+   $e = microtime(true);
+
$results = $task-getResult();

+   if (isset($results[0])  is_object($results[0])) {
+   $results[0]-setTime($e-$s);
+   }
+
rtTestOutputWriter::flushResult($results, 
$this-reportStatus, $cid);

$response = serialize($results).[END];

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