g2 Wed Jul 8 19:23:23 2009 UTC
Added files:
/phpruntests/src rtException.php
Modified files:
/phpruntests/src rtClassMap.php
/phpruntests/src/testcase/sections/executablesections
rtCleanSection.php
rtFileSection.php
rtSkipIfSection.php
/phpruntests/src/testcase rtPhpRunner.php
/phpruntests/src/taskScheduler rtTaskSchedulerFile.php
Log:
phpruntests - moved rtException in root, replaced PhpRunnerException - added
singal-handler to taskSchedulerFile
http://cvs.php.net/viewvc.cgi/phpruntests/src/rtClassMap.php?r1=1.15&r2=1.16&diff_format=u
Index: phpruntests/src/rtClassMap.php
diff -u phpruntests/src/rtClassMap.php:1.15 phpruntests/src/rtClassMap.php:1.16
--- phpruntests/src/rtClassMap.php:1.15 Sun Jun 28 09:47:37 2009
+++ phpruntests/src/rtClassMap.php Wed Jul 8 19:23:23 2009
@@ -8,7 +8,6 @@
*/
$rtClassMap = array(
'rtEnvironmentException' =>
'configuration/exceptions/rtEnvironmentException.php',
- 'rtException' =>
'configuration/exceptions/rtException.php',
'rtMissingArgumentException' =>
'configuration/exceptions/rtMissingArgumentException.php',
'rtUnknownIniSettingException' =>
'configuration/exceptions/rtUnknownIniSettingException.php',
'rtUnknownOptionException' =>
'configuration/exceptions/rtUnknownOptionException.php',
@@ -46,6 +45,7 @@
'rtAutoload' => 'rtAutoload.php',
'rtClassMap' => 'rtClassMap.php',
'rtDirectoryList' => 'rtDirectoryList.php',
+ 'rtException' => 'rtException.php',
'rtPhptFilterIterator' => 'rtPhptFilterIterator.php',
'rtText' => 'rtText.php',
'rtUtil' => 'rtUtil.php',
@@ -55,7 +55,6 @@
'rtTaskSchedulerFile' =>
'taskScheduler/rtTaskSchedulerFile.php',
'rtTaskSchedulerMsgQ' =>
'taskScheduler/rtTaskSchedulerMsgQ.php',
'rtTaskTestGroup' =>
'taskScheduler/rtTaskTestGroup.php',
- 'rtCodeRunnerException' =>
'testcase/exceptions/rtCodeRunnerException.php',
'rtPhpRunnerException' =>
'testcase/exceptions/rtPhpRunnerException.php',
'rtTestOutputWriterCSV' =>
'testcase/output/rtTestOutputWriterCSV.php',
'rtTestOutputWriterList' =>
'testcase/output/rtTestOutputWriterList.php',
http://cvs.php.net/viewvc.cgi/phpruntests/src/testcase/sections/executablesections/rtCleanSection.php?r1=1.5&r2=1.6&diff_format=u
Index: phpruntests/src/testcase/sections/executablesections/rtCleanSection.php
diff -u
phpruntests/src/testcase/sections/executablesections/rtCleanSection.php:1.5
phpruntests/src/testcase/sections/executablesections/rtCleanSection.php:1.6
--- phpruntests/src/testcase/sections/executablesections/rtCleanSection.php:1.5
Tue Jun 2 19:12:08 2009
+++ phpruntests/src/testcase/sections/executablesections/rtCleanSection.php
Wed Jul 8 19:23:23 2009
@@ -43,7 +43,7 @@
$testStatus->setMessage('fail_clean','Execution of clean
section failed: '.trim($this->output) );
}
- } catch (rtPhpRunnerException $e) {
+ } catch (rtException $e) {
$testStatus->setTrue('fail_clean');
$testStatus->setMessage('fail_clean',$e->getMessage);
}
http://cvs.php.net/viewvc.cgi/phpruntests/src/testcase/sections/executablesections/rtFileSection.php?r1=1.13&r2=1.14&diff_format=u
Index: phpruntests/src/testcase/sections/executablesections/rtFileSection.php
diff -u
phpruntests/src/testcase/sections/executablesections/rtFileSection.php:1.13
phpruntests/src/testcase/sections/executablesections/rtFileSection.php:1.14
--- phpruntests/src/testcase/sections/executablesections/rtFileSection.php:1.13
Tue Jun 2 19:12:08 2009
+++ phpruntests/src/testcase/sections/executablesections/rtFileSection.php
Wed Jul 8 19:23:23 2009
@@ -67,7 +67,7 @@
}
- } catch (rtPhpRunnerException $e) {
+ } catch (rtException $e) {
$testStatus->setTrue('fail');
$testStatus->setMessage('fail', $e->getMessage() );
}
http://cvs.php.net/viewvc.cgi/phpruntests/src/testcase/sections/executablesections/rtSkipIfSection.php?r1=1.5&r2=1.6&diff_format=u
Index: phpruntests/src/testcase/sections/executablesections/rtSkipIfSection.php
diff -u
phpruntests/src/testcase/sections/executablesections/rtSkipIfSection.php:1.5
phpruntests/src/testcase/sections/executablesections/rtSkipIfSection.php:1.6
---
phpruntests/src/testcase/sections/executablesections/rtSkipIfSection.php:1.5
Tue Jun 2 19:12:08 2009
+++ phpruntests/src/testcase/sections/executablesections/rtSkipIfSection.php
Wed Jul 8 19:23:23 2009
@@ -51,7 +51,7 @@
$testStatus->setMessage('warn', $matches[1]);
}
}
- } catch (rtPhpRunnerException $e) {
+ } catch (rtException $e) {
$testStatus->setTrue('fail_skip');
$testStatus->setMessage('fail_skip', 'Failed to execute skipif
section' . $e->getMessage());
}
http://cvs.php.net/viewvc.cgi/phpruntests/src/testcase/rtPhpRunner.php?r1=1.3&r2=1.4&diff_format=u
Index: phpruntests/src/testcase/rtPhpRunner.php
diff -u phpruntests/src/testcase/rtPhpRunner.php:1.3
phpruntests/src/testcase/rtPhpRunner.php:1.4
--- phpruntests/src/testcase/rtPhpRunner.php:1.3 Mon May 25 12:28:40 2009
+++ phpruntests/src/testcase/rtPhpRunner.php Wed Jul 8 19:23:23 2009
@@ -58,6 +58,8 @@
fclose($pipes[0]);
+ $counter = 0;
+
while (true) {
/* hide errors from interrupted syscalls */
$r = $pipes;
@@ -67,14 +69,19 @@
$n = @stream_select($r, $w, $e, $this->timeOut);
if ($n === false) {
- throw new rtPhpRunnerException('Stream select failure in
rtPhpRunner');
+ throw new rtException('Stream select failure in rtPhpRunner');
} else if ($n === 0) {
proc_terminate($proc);
- throw new rtPhpRunnerException ('The process running test code
has timed out in rtPhpRunner');
+ throw new rtException('The process running test code has timed
out in rtPhpRunner');
} else if ($n > 0) {
- $line = fread($pipes[1], 8192);
+ $counter++;
+ if ($counter > 10) {
+ proc_terminate($proc);
+ throw new rtException('The process running test code
has timed out in rtPhpRunner');
+ }
+ $line = fread($pipes[1], 8192);
if (strlen($line) == 0) {
- /* EOF */
+ // EOF
break;
}
$data .= (binary) $line;
http://cvs.php.net/viewvc.cgi/phpruntests/src/taskScheduler/rtTaskSchedulerFile.php?r1=1.5&r2=1.6&diff_format=u
Index: phpruntests/src/taskScheduler/rtTaskSchedulerFile.php
diff -u phpruntests/src/taskScheduler/rtTaskSchedulerFile.php:1.5
phpruntests/src/taskScheduler/rtTaskSchedulerFile.php:1.6
--- phpruntests/src/taskScheduler/rtTaskSchedulerFile.php:1.5 Sun Jul 5
20:51:15 2009
+++ phpruntests/src/taskScheduler/rtTaskSchedulerFile.php Wed Jul 8
19:23:23 2009
@@ -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
@@ -76,6 +88,8 @@
if ($this->processCount > sizeof($this->taskList)) {
$this->processCount = sizeof($this->taskList);
}
+
+
// distribute the task to the children
$this->distributeTasks();
@@ -99,7 +113,13 @@
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);
@@ -174,6 +194,8 @@
unlink(self::TMP_FILE.$cid);
}
+
+ $this->pidStore = array();
}
http://cvs.php.net/viewvc.cgi/phpruntests/src/rtException.php?view=markup&rev=1.1
Index: phpruntests/src/rtException.php
+++ phpruntests/src/rtException.php
<?php
class rtException extends RuntimeException
{
public function __toString()
{
$r =
"\n--------------------------------------------------------------------------------\n";
$r .= "RUN-TESTS EXCEPTION\n";
$r .= $this->getMessage()." (CODE ".$this->getCode().")\n";
$r .= $this->getFile().":".$this->getLine()."\n\n";
$r .= $this->getTraceAsString();
$r .=
"\n--------------------------------------------------------------------------------\n";
return $r;
}
}
?>
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php