zoe Sat, 08 Aug 2009 20:22:39 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=286934
Log: reworked valgrind support to be a little more in line with run-tests.php Changed paths: U php/phpruntests/trunk/src/testcase/rtPhpTest.php U php/phpruntests/trunk/src/testcase/rtTestResults.php U php/phpruntests/trunk/src/testcase/rtTestStatus.php U php/phpruntests/trunk/src/testcase/sections/executablesections/rtFileSection.php Modified: php/phpruntests/trunk/src/testcase/rtPhpTest.php =================================================================== --- php/phpruntests/trunk/src/testcase/rtPhpTest.php 2009-08-08 20:11:30 UTC (rev 286933) +++ php/phpruntests/trunk/src/testcase/rtPhpTest.php 2009-08-08 20:22:39 UTC (rev 286934) @@ -79,8 +79,6 @@ //Identify the file and expect section types $this->fileSection = $this->setFileSection(); $this->expectSection = $this->setExpectSection(); - $this->fileSection->setExecutableFileName($this->getName()); - } Modified: php/phpruntests/trunk/src/testcase/rtTestResults.php =================================================================== --- php/phpruntests/trunk/src/testcase/rtTestResults.php 2009-08-08 20:11:30 UTC (rev 286933) +++ php/phpruntests/trunk/src/testcase/rtTestResults.php 2009-08-08 20:22:39 UTC (rev 286934) @@ -113,6 +113,10 @@ $testCase->getSection('SKIPIF')->deleteFile(); } + if($testCase->getStatus()->getValue('leak') == true) { + $this->savedFileNames['mem'] = $testCase->getSection('FILE')->getMemFileName(); + } + } protected function onFail(rtPhpTest $testCase) @@ -146,6 +150,10 @@ if ($testCase->hasSection('SKIPIF')) { $this->savedFileNames['skipif'] = $this->testName. 'skipif.php'; } + + if($testCase->getStatus()->getValue('leak') == true) { + $this->savedFileNames['mem'] = $testCase->getSection('FILE')->getMemFileName(); + } } protected function onSkip(rtPhpTest $testCase, rtRuntestsConfiguration $runConfiguration) @@ -153,10 +161,10 @@ if ($runConfiguration->hasCommandLineOption('keep-all') || $runConfiguration->hasCommandLineOption('keep-skip')) { $this->savedFileNames['skipif'] = $this->testName. 'skipif.php'; } else if($testCase->hasSection('SKIPIF')) { - $skipSection = $testCase->getSection('SKIPIF'); - $skipSection->deleteFile(); + $testCase->getSection('SKIPIF')->deleteFile(); } + //TODO I think this can go? Have since updated code to BORK on finding blank sections //It may seem odd to check for an XFAIL if we are skipping the test, on the other hand I found //a few windows tests with blank XFAIL sections and wanted to know about those. @@ -166,6 +174,8 @@ } } + + public function getStatus() { return $this->testStatus; Modified: php/phpruntests/trunk/src/testcase/rtTestStatus.php =================================================================== --- php/phpruntests/trunk/src/testcase/rtTestStatus.php 2009-08-08 20:11:30 UTC (rev 286933) +++ php/phpruntests/trunk/src/testcase/rtTestStatus.php 2009-08-08 20:22:39 UTC (rev 286934) @@ -27,6 +27,7 @@ 'fail_skip', 'fail_headers', 'pass_headers', + 'leak', ); public function __construct($testName) Modified: php/phpruntests/trunk/src/testcase/sections/executablesections/rtFileSection.php =================================================================== --- php/phpruntests/trunk/src/testcase/sections/executablesections/rtFileSection.php 2009-08-08 20:11:30 UTC (rev 286933) +++ php/phpruntests/trunk/src/testcase/sections/executablesections/rtFileSection.php 2009-08-08 20:22:39 UTC (rev 286934) @@ -18,13 +18,9 @@ protected $headers; protected $memFileName; - public function setExecutableFileName($testName) - { - $this->fileName = $testName . ".php"; - $this->memFileName = $testName . ".mem"; - } - protected function init() { + $this->fileName = $this->testName . ".php"; + $this->memFileName = $this->testName . ".mem"; } public function run(rtPhpTest $testCase, rtRuntestsConfiguration $runConfiguration) @@ -83,6 +79,15 @@ $testStatus->setMessage('fail', $e->getMessage() ); } + + if($runConfiguration->hasMemoryTool()) { + if(filesize($this->memFileName) > 0) { + $testStatus->setTrue('leak'); + } else { + $this->deleteMemFile(); + } + } + return $testStatus; } @@ -99,5 +104,10 @@ @unlink($this->memFileName); } + + public function getMemFileName() { + return $this->memFileName; + } + } ?>
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php