com phpruntests: reworked valgrind support to be a little more in line with run-tests.php: src/testcase/rtPhpTest.php src/testcase/rtTestResults.php
src/testcase/rtTestStatus.php src/testcase/sections/executablesections/rtFileSection.php

From: Date: Sat, 08 Aug 2009 20:22:39 +0000
Subject: com phpruntests: reworked valgrind support to be a little more in line with run-tests.php: src/testcase/rtPhpTest.php src/testcase/rtTestResults.php
src/testcase/rtTestStatus.php src/testcase/sections/executablesections/rtFileSection.php
Groups: php.qa 
Request: Send a blank email to php-qa+get-66303@lists.php.net to get a copy of this message
Commit: c09ce984e9de7bfe74c436e1416a4f71b9858d24 Author: Zoe Slattery <zoe@php.net> Sat, 8 Aug 2009 20:22:39 +0000 Parents: ec4c24802e707706087f4a7cf4e818198815136f Branches: master Link: http://git.php.net/?p=phpruntests.git;a=commitdiff;h=c09ce984e9de7bfe74c436e1416a4f71b9858d24 Log: reworked valgrind support to be a little more in line with run-tests.php Changed paths: M src/testcase/rtPhpTest.php M src/testcase/rtTestResults.php M src/testcase/rtTestStatus.php M src/testcase/sections/executablesections/rtFileSection.php Diff: diff --git a/src/testcase/rtPhpTest.php b/src/testcase/rtPhpTest.php index 785bf3e..0cce4ee 100644 --- a/src/testcase/rtPhpTest.php +++ b/src/testcase/rtPhpTest.php @@ -79,8 +79,6 @@ class rtPhpTest //Identify the file and expect section types $this->fileSection = $this->setFileSection(); $this->expectSection = $this->setExpectSection(); - $this->fileSection->setExecutableFileName($this->getName()); - } diff --git a/src/testcase/rtTestResults.php b/src/testcase/rtTestResults.php index 3f7e6c8..0aa8597 100644 --- a/src/testcase/rtTestResults.php +++ b/src/testcase/rtTestResults.php @@ -113,6 +113,10 @@ class rtTestResults $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 @@ class rtTestResults 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 @@ class rtTestResults 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 @@ class rtTestResults } } + + public function getStatus() { return $this->testStatus; diff --git a/src/testcase/rtTestStatus.php b/src/testcase/rtTestStatus.php index 793ba75..084c326 100644 --- a/src/testcase/rtTestStatus.php +++ b/src/testcase/rtTestStatus.php @@ -27,6 +27,7 @@ class rtTestStatus { 'fail_skip', 'fail_headers', 'pass_headers', + 'leak', ); public function __construct($testName) diff --git a/src/testcase/sections/executablesections/rtFileSection.php b/src/testcase/sections/executablesections/rtFileSection.php index 58ac759..6b7e729 100644 --- a/src/testcase/sections/executablesections/rtFileSection.php +++ b/src/testcase/sections/executablesections/rtFileSection.php @@ -18,13 +18,9 @@ class rtFileSection extends rtExecutableSection 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 @@ class rtFileSection extends rtExecutableSection $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 @@ class rtFileSection extends rtExecutableSection @unlink($this->memFileName); } + + public function getMemFileName() { + return $this->memFileName; + } + } ?>

« previous php.qa (#66303) next »