zoe Sun, 02 Aug 2009 20:33:32 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=286696
Log:
More valgrind stuff
Changed paths:
U php/phpruntests/trunk/src/configuration/rtEnvironmentVariables.php
D php/phpruntests/trunk/src/configuration/rtExternalTool.php
A + php/phpruntests/trunk/src/configuration/rtMemoryTool.php
(from
php/phpruntests/trunk/src/configuration/rtExternalTool.php:r286467)
U php/phpruntests/trunk/src/configuration/rtRuntestsConfiguration.php
U php/phpruntests/trunk/src/configuration/tools/rtValgrind.php
U php/phpruntests/trunk/src/rtClassMap.php
U php/phpruntests/trunk/src/testcase/rtTestResults.php
U
php/phpruntests/trunk/src/testcase/sections/executablesections/rtFileSection.php
Modified: php/phpruntests/trunk/src/configuration/rtEnvironmentVariables.php
===================================================================
--- php/phpruntests/trunk/src/configuration/rtEnvironmentVariables.php 2009-08-02 20:21:51 UTC (rev 286695)
+++ php/phpruntests/trunk/src/configuration/rtEnvironmentVariables.php 2009-08-02 20:33:32 UTC (rev 286696)
@@ -57,6 +57,7 @@
$this->environmentVariables[$variable] = getenv($variable);
}
}
+
}
public function setVariable($var,$value)
Deleted: php/phpruntests/trunk/src/configuration/rtExternalTool.php
===================================================================
--- php/phpruntests/trunk/src/configuration/rtExternalTool.php 2009-08-02 20:21:51 UTC (rev 286695)
+++ php/phpruntests/trunk/src/configuration/rtExternalTool.php 2009-08-02 20:33:32 UTC (rev 286696)
@@ -1,45 +0,0 @@
-<?php
-/**
- * rtExternalTool
- *
- * Class to handle using an external tool (default is valgrind)
- *
- * @category Testing
- * @package RUNTESTS
- * @author Zoe Slattery <[email protected]>
- * @author Stefan Priebsch <[email protected]>
- * @copyright 2009 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @link http://qa.php.net/
- *
- */
-
-class rtExternalTool
-{
- protected $command;
- protected $options;
- protected $version;
-
- public static function getInstance($configuration)
- {
- if($configuration->hasCommandLineOption('m')) {
- return new rtValgrind();
- } else {
- $name = 'rt' . $configuration->getCommandLineOption('mtool');
- return new $name();
- }
- }
-
- public function init(rtRuntestsConfiguration $configuration) {
- $this->setVersion();
- $this->setCommand($configuration);
- $this->setOptions($configuration);
- }
-
- public function getCommand() {
- return $this->command;
- }
-
-
-}
-?>
\ No newline at end of file
Copied: php/phpruntests/trunk/src/configuration/rtMemoryTool.php (from rev 286467, php/phpruntests/trunk/src/configuration/rtExternalTool.php)
===================================================================
--- php/phpruntests/trunk/src/configuration/rtMemoryTool.php (rev 0)
+++ php/phpruntests/trunk/src/configuration/rtMemoryTool.php 2009-08-02 20:33:32 UTC (rev 286696)
@@ -0,0 +1,46 @@
+<?php
+/**
+ * rtExternalTool
+ *
+ * Class to handle using an external tool (default is valgrind)
+ *
+ * @category Testing
+ * @package RUNTESTS
+ * @author Zoe Slattery <[email protected]>
+ * @author Stefan Priebsch <[email protected]>
+ * @copyright 2009 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @link http://qa.php.net/
+ *
+ */
+
+class rtMemoryTool
+{
+ protected $command;
+ protected $options;
+ protected $version;
+
+ public static function getInstance($configuration)
+ {
+ if($configuration->hasCommandLineOption('m')) {
+ return new rtValgrind();
+ } else {
+ $name = 'rt' . $configuration->getCommandLineOption('mtool');
+ return new $name();
+ }
+ }
+
+ public function init(rtRuntestsConfiguration $configuration) {
+ $this->setVersion();
+ $this->setCommand($configuration);
+ $this->setOptions($configuration);
+ $this->setEnvironment($configuration);
+ }
+
+ public function getCommand() {
+ return $this->command;
+ }
+
+
+}
+?>
\ No newline at end of file
Modified: php/phpruntests/trunk/src/configuration/rtRuntestsConfiguration.php
===================================================================
--- php/phpruntests/trunk/src/configuration/rtRuntestsConfiguration.php 2009-08-02 20:21:51 UTC (rev 286695)
+++ php/phpruntests/trunk/src/configuration/rtRuntestsConfiguration.php 2009-08-02 20:33:32 UTC (rev 286696)
@@ -23,7 +23,7 @@
private $environmentVariables;
private $commandLine;
- private $externalTool = null;
+ private $memoryTool = null;
private $settingNames = array (
@@ -70,12 +70,12 @@
$options = new rtAddToCommandLine();
$options->parseAdditionalOptions($this->commandLine, $this->environmentVariables);
- //if there is an external tool - configure it
+ //if there is an memory tool - configure it
if($this->commandLine->hasOption('m') || $this->commandLine->hasOption('mtool')) {
- $this->externalTool = rtExternalTool::getInstance($this);
- $this->externalTool->checkAvailable($this);
- $this->externalTool->init($this);
+ $this->memoryTool = rtMemoryTool::getInstance($this);
+ $this->memoryTool->checkAvailable($this);
+ $this->memoryTool->init($this);
}
@@ -136,7 +136,7 @@
}
/**
- * required for testing?
+ * required for testing - also used by memory tools
*
* @param unknown_type $name
* @param unknown_type $value
@@ -156,15 +156,15 @@
$this->environmentVariables->getUserSuppliedVariables();
}
- public function hasExternalTool() {
- if($this->externalTool != null) {
+ public function hasMemoryTool() {
+ if($this->memoryTool != null) {
return true;
}
return false;
}
- public function getExternalToolCommand() {
- return $this->externalTool->getCommand();
+ public function getMemoryToolCommand() {
+ return $this->memoryTool->getCommand();
}
}
Modified: php/phpruntests/trunk/src/configuration/tools/rtValgrind.php
===================================================================
--- php/phpruntests/trunk/src/configuration/tools/rtValgrind.php 2009-08-02 20:21:51 UTC (rev 286695)
+++ php/phpruntests/trunk/src/configuration/tools/rtValgrind.php 2009-08-02 20:33:32 UTC (rev 286696)
@@ -15,7 +15,7 @@
*/
-class rtValgrind extends rtExternalTool
+class rtValgrind extends rtMemoryTool
{
public function checkAvailable($configuration)
{
@@ -48,5 +48,9 @@
$this->command .= " " . $options . " --log-file-exactly=";
}
}
+
+ public function setEnvironment($configuration) {
+ $configuration->setEnvironmentVariable('USE_ZEND_ALLOC', '0');
+ }
}
?>
\ No newline at end of file
Modified: php/phpruntests/trunk/src/rtClassMap.php
===================================================================
--- php/phpruntests/trunk/src/rtClassMap.php 2009-08-02 20:21:51 UTC (rev 286695)
+++ php/phpruntests/trunk/src/rtClassMap.php 2009-08-02 20:33:32 UTC (rev 286696)
@@ -23,8 +23,8 @@
'rtAddToCommandLine' => 'configuration/rtAddToCommandLine.php',
'rtCommandLineOptions' => 'configuration/rtCommandLineOptions.php',
'rtEnvironmentVariables' => 'configuration/rtEnvironmentVariables.php',
- 'rtExternalTool' => 'configuration/rtExternalTool.php',
'rtIniAsCommandLineArgs' => 'configuration/rtIniAsCommandLineArgs.php',
+ 'rtMemoryTool' => 'configuration/rtMemoryTool.php',
'rtPreCondition' => 'configuration/rtPreCondition.php',
'rtPreConditionList' => 'configuration/rtPreConditionList.php',
'rtRuntestsConfiguration' => 'configuration/rtRuntestsConfiguration.php',
Modified: php/phpruntests/trunk/src/testcase/rtTestResults.php
===================================================================
--- php/phpruntests/trunk/src/testcase/rtTestResults.php 2009-08-02 20:21:51 UTC (rev 286695)
+++ php/phpruntests/trunk/src/testcase/rtTestResults.php 2009-08-02 20:33:32 UTC (rev 286696)
@@ -54,6 +54,16 @@
} else {
echo "no status? something wrong here\n";
}
+
+ //Deal with mem files generated by memory checking tools. Save or not, irrespective of status
+
+ if(file_exists($this->testName . '.mem')) {
+ if(filesize($this->testName . '.mem') > 0) {
+ $this->savedFileNames['mem'] = $this->testName. ".mem";
+ } else {
+ @unlink($this->testName . '.mem');
+ }
+ }
}
/**
@@ -95,6 +105,7 @@
if ($testCase->hasSection('SKIPIF')) {
$testCase->getSection('SKIPIF')->deleteFile();
}
+
}
private function onFail(rtPhpTest $testCase)
Modified: php/phpruntests/trunk/src/testcase/sections/executablesections/rtFileSection.php
===================================================================
--- php/phpruntests/trunk/src/testcase/sections/executablesections/rtFileSection.php 2009-08-02 20:21:51 UTC (rev 286695)
+++ php/phpruntests/trunk/src/testcase/sections/executablesections/rtFileSection.php 2009-08-02 20:33:32 UTC (rev 286696)
@@ -29,13 +29,13 @@
public function run(rtPhpTest $testCase, rtRuntestsConfiguration $runConfiguration)
{
-
+
$testStatus = $testCase->getStatus();
$this->writeExecutableFile();
-
+
$commandPrefix = "";
- if($runConfiguration->hasExternalTool()) {
- $commandPrefix = $runConfiguration->getExternalToolCommand();
+ if($runConfiguration->hasMemoryTool()) {
+ $commandPrefix = $runConfiguration->getMemoryToolCommand();
//This assumes that the external tool write its output to a *.mem file
$commandPrefix .= $this->memFileName;
}
@@ -45,7 +45,7 @@
// The CGI excutable is null if it is not available, check and SKIP if necessary
if (is_null($phpExecutable)) {
$testStatus->setTrue('skip');
- $testStatus->setMessage('skip', 'The CGI executable is unavailable' );
+ $testStatus->setMessage('skip', 'The CGI executable is unavailable' );
return $testStatus;
}
@@ -80,20 +80,24 @@
} catch (rtException $e) {
$testStatus->setTrue('fail');
- $testStatus->setMessage('fail', $e->getMessage() );
+ $testStatus->setMessage('fail', $e->getMessage() );
}
-
- return $testStatus;
-}
-/**
- *
- */
-public function getHeaders()
-{
- return $this->headers;
-}
+ return $testStatus;
+ }
+ /**
+ *
+ */
+ public function getHeaders()
+ {
+ return $this->headers;
+ }
+
+ public function deleteMemFile() {
+ @unlink($this->memFileName);
+ }
+
}
?>
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php