summaryrefslogtreecommitdiffstats
path: root/Source/CTest/cmCTestRunTest.cxx
diff options
context:
space:
mode:
authorZach Mullen <zach.mullen@kitware.com>2009-09-03 19:33:44 (GMT)
committerZach Mullen <zach.mullen@kitware.com>2009-09-03 19:33:44 (GMT)
commitd4adde13d7d507f5896b8c7912e46bbbcb71b539 (patch)
tree45e30f838f6443a50c276be0f0507ee392020799 /Source/CTest/cmCTestRunTest.cxx
parentf686dbecb6c25178954b8190e95a3a265e9b2813 (diff)
downloadCMake-d4adde13d7d507f5896b8c7912e46bbbcb71b539.zip
CMake-d4adde13d7d507f5896b8c7912e46bbbcb71b539.tar.gz
CMake-d4adde13d7d507f5896b8c7912e46bbbcb71b539.tar.bz2
Allowed tests to pull more than one line of output in their quantum. Fixed uninitialized variables in the case that the test process could not start.
Diffstat (limited to 'Source/CTest/cmCTestRunTest.cxx')
-rw-r--r--Source/CTest/cmCTestRunTest.cxx54
1 files changed, 34 insertions, 20 deletions
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index 81dff52..85e8601 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -38,25 +38,36 @@ bool cmCTestRunTest::IsRunning()
void cmCTestRunTest::CheckOutput()
{
std::string out, err;
- int pipe = this->TestProcess->CheckOutput(.1, out, err);
- if(pipe == cmsysProcess_Pipe_STDOUT)
+ int pipe = this->TestProcess->CheckOutput(.1);
+ //start our timeout for reading the process output
+ double clock_start = cmSystemTools::GetTime();
+ while(this->TestProcess->GetNextOutputLine(out, err))
{
- cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
- this->GetIndex() << ": " << out << std::endl);
- this->ProcessOutput += out;
- this->ProcessOutput += "\n";
- }
- else if(pipe == cmsysProcess_Pipe_STDERR)
- {
- cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
- this->GetIndex() << ": " << err << std::endl);
- this->ProcessOutput += err;
- this->ProcessOutput += "\n";
+
+ if(pipe == cmsysProcess_Pipe_STDOUT)
+ {
+ cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+ this->GetIndex() << ": " << out << std::endl);
+ this->ProcessOutput += out;
+ this->ProcessOutput += "\n";
+ }
+ else if(pipe == cmsysProcess_Pipe_STDERR)
+ {
+ cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+ this->GetIndex() << ": " << err << std::endl);
+ this->ProcessOutput += err;
+ this->ProcessOutput += "\n";
+ }
+ //timeout while reading process output (could denote infinite output)
+ if(cmSystemTools::GetTime() - clock_start > .1)
+ {
+ break;
+ }
}
}
//---------------------------------------------------------
-bool cmCTestRunTest::EndTest(size_t completed, size_t total)
+bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
{
//restore the old environment
if (this->ModifyEnv)
@@ -240,12 +251,14 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total)
<< "----------------------------------------------------------"
<< std::endl << std::endl;
}
- this->TestResult.Output = this->ProcessOutput;
- this->TestResult.ReturnValue = this->TestProcess->GetExitValue();
- this->TestResult.CompletionStatus = "Completed";
- this->TestResult.ExecutionTime = this->TestProcess->GetTotalTime();
- this->TestHandler->TestResults.push_back( this->TestResult );
-
+ if(started)
+ {
+ this->TestResult.Output = this->ProcessOutput;
+ this->TestResult.ReturnValue = this->TestProcess->GetExitValue();
+ this->TestResult.CompletionStatus = "Completed";
+ this->TestResult.ExecutionTime = this->TestProcess->GetTotalTime();
+ this->TestHandler->TestResults.push_back( this->TestResult );
+ }
this->MemCheckPostProcess();
delete this->TestProcess;
@@ -290,6 +303,7 @@ bool cmCTestRunTest::StartTest()
this->TestResult.Properties = this->TestProperties;
this->TestResult.ExecutionTime = 0;
this->TestResult.ReturnValue = -1;
+ this->TestResult.CompletionStatus = "Not Run";
this->TestResult.Status = cmCTestTestHandler::NOT_RUN;
this->TestResult.TestCount = this->TestProperties->Index;
this->TestResult.Name = this->TestProperties->Name;