Fix segfault on Borland compiler resulting from divide by 0.

This commit is contained in:
Zach Mullen 2009-12-18 11:42:58 -05:00
parent 918355632c
commit 66f44f64d5
1 changed files with 12 additions and 16 deletions

View File

@ -26,7 +26,7 @@ cmCTestRunTest::cmCTestRunTest(cmCTestTestHandler* handler)
this->TestProcess = 0;
this->TestResult.ExecutionTime =0;
this->TestResult.ReturnValue = 0;
this->TestResult.Status = 0;
this->TestResult.Status = cmCTestTestHandler::NOT_RUN;
this->TestResult.TestCount = 0;
this->TestResult.Properties = 0;
this->ProcessOutput = "";
@ -120,8 +120,11 @@ void cmCTestRunTest::CompressOutput()
this->CompressedOutput += encoded_buffer[i];
}
if(strm.total_in)
{
this->CompressionRatio = static_cast<double>(strm.total_out) /
static_cast<double>(strm.total_in);
}
delete [] encoded_buffer;
delete [] out;
@ -268,19 +271,12 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
// if this is doing MemCheck then all the output needs to be put into
// Output since that is what is parsed by cmCTestMemCheckHandler
if(!this->TestHandler->MemCheck && started)
{
if (this->TestResult.Status == cmCTestTestHandler::COMPLETED)
{
this->TestHandler->CleanTestOutput(this->ProcessOutput,
static_cast<size_t>
(this->TestHandler->CustomMaximumPassedTestOutputSize));
}
else
{
this->TestHandler->CleanTestOutput(this->ProcessOutput,
static_cast<size_t>
(this->TestHandler->CustomMaximumFailedTestOutputSize));
}
(this->TestResult.Status == cmCTestTestHandler::COMPLETED ?
this->TestHandler->CustomMaximumPassedTestOutputSize :
this->TestHandler->CustomMaximumFailedTestOutputSize));
}
this->TestResult.Reason = reason;
if (this->TestHandler->LogFile)
@ -325,7 +321,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
<< "----------------------------------------------------------"
<< std::endl << std::endl;
}
// if the test actually stared and ran
// if the test actually started and ran
// record the results in TestResult
if(started)
{