Hanle the case where a test can not be run because it is a bad executable.

This commit is contained in:
Bill Hoffman 2009-12-02 16:37:43 -05:00
parent 4d72006bd6
commit 22c37b2b19
2 changed files with 14 additions and 15 deletions

View File

@ -177,12 +177,6 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
this->TestResult.Status = cmCTestTestHandler::OTHER_FAULT;
}
}
else // if ( res == cmsysProcess_State_Error )
{
cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Bad command " << res );
this->TestResult.Status = cmCTestTestHandler::BAD_COMMAND;
}
passed = this->TestResult.Status == cmCTestTestHandler::COMPLETED;
char buf[1024];
sprintf(buf, "%6.2f sec", this->TestProcess->GetTotalTime());
@ -258,16 +252,19 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
<< "----------------------------------------------------------"
<< std::endl << std::endl;
}
// if the test actually stared and ran
// record the results in 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();
}
// Always push the current TestResult onto the
// TestHandler vector
this->TestHandler->TestResults.push_back(this->TestResult);
delete this->TestProcess;
return passed;
}
@ -309,8 +306,8 @@ bool cmCTestRunTest::StartTest(size_t total)
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.CompletionStatus = "Failed to start";
this->TestResult.Status = cmCTestTestHandler::BAD_COMMAND;
this->TestResult.TestCount = this->TestProperties->Index;
this->TestResult.Name = this->TestProperties->Name;
this->TestResult.Path = this->TestProperties->Directory.c_str();
@ -318,6 +315,8 @@ bool cmCTestRunTest::StartTest(size_t total)
// log and return if we did not find the executable
if (this->ActualCommand == "")
{
// if the command was not found create a TestResult object
// that has that information
this->TestProcess = new cmProcess;
*this->TestHandler->LogFile << "Unable to find executable: "
<< args[1].c_str() << std::endl;
@ -325,7 +324,8 @@ bool cmCTestRunTest::StartTest(size_t total)
<< args[1].c_str() << std::endl);
this->TestResult.Output = "Unable to find executable: " + args[1];
this->TestResult.FullCommandLine = "";
this->TestHandler->TestResults.push_back(this->TestResult);
this->TestResult.CompletionStatus = "Not Run";
this->TestResult.Status = cmCTestTestHandler::NOT_RUN;
return false;
}
this->StartTime = this->CTest->CurrentTime();

View File

@ -689,13 +689,12 @@ void cmCTestTestHandler::PrintLabelSummary()
}
}
}
it = this->TestList.begin();
ri = this->TestResults.begin();
// fill maps
for(; it != this->TestList.end(); ++it, ++ri)
for(; ri != this->TestResults.end(); ++ri)
{
cmCTestTestProperties& p = *it;
cmCTestTestResult &result = *ri;
cmCTestTestResult &result = *ri;
cmCTestTestProperties& p = *result.Properties;
if(p.Labels.size() != 0)
{
for(std::vector<std::string>::iterator l = p.Labels.begin();